Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
reidsolon2 committed Dec 19, 2024
0 parents commit 425afd4
Show file tree
Hide file tree
Showing 117 changed files with 14,889 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
59 changes: 59 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Filament + Tenancy For Laravel Starter

This repository provides a streamlined starting point for integrating the Filament Admin panel with the Laravel Tenancy package. Just a default setup.

- [Tenancy For Laravel](https://tenancyforlaravel.com/docs/v3/introduction/)
- [Filament](https://filamentphp.com/)

### Create a tenant

```php artisan app:create-tenant {tenant} {domain?}```

### Create an admin user for tenant

```php artisan app:create-admin {tenant} {name} {email} {password}```
54 changes: 54 additions & 0 deletions app/Console/Commands/CreateTenant.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\Console\Commands;

use App\Models\Domain;
use App\Models\Tenant;
use Illuminate\Console\Command;

class CreateTenant extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:create-tenant {name} {domain?}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'This will create tenant with custom domain';

/**
* Execute the console command.
*/
public function handle()
{
$this->info('Creating tenant...');

if (Tenant::find($this->argument('name'))) {
$this->error('Tenant already exists!');

return;
}

if (Domain::whereDomain($this->argument('domain'))->exists()) {
$this->error('Domain already exists!');

return;
}

$tenant = Tenant::create([
'id' => $this->argument('name'),
]);

$tenant->domains()->create([
'domain' => $this->argument('domain'),
]);

$this->info('Tenant created successfully.');
}
}
48 changes: 48 additions & 0 deletions app/Console/Commands/CreateTenantAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace App\Console\Commands;

use App\Models\Tenant;
use App\Models\Tenant\Admin;
use Illuminate\Console\Command;

class CreateTenantAdmin extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:create-admin {tenant} {name} {email} {password}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'This will create tenant admin for cms';

/**
* Execute the console command.
*/
public function handle()
{
$this->info('Creating admin user...');

if (! $tenant = Tenant::find($this->argument('tenant'))) {
$this->error('Tenant not found');
return;
}

$tenant->run(function () {
Admin::firstOrCreate([
'email' => $this->argument('email'),
], [
'name' => $this->argument('name'),
'password' => bcrypt($this->argument('password')),
]);
});

$this->info('Admin user created successfully.');
}
}
30 changes: 30 additions & 0 deletions app/Console/Commands/InitializeStarterKit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class InitializeStarterKit extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'starter:init';

/**
* The console command description.
*
* @var string
*/
protected $description = 'This will initialize the boilerplate';

/**
* Execute the console command.
*/
public function handle()
{
//
}
}
27 changes: 27 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
30 changes: 30 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* The list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}
}
12 changes: 12 additions & 0 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
}
Loading

0 comments on commit 425afd4

Please sign in to comment.