1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 15:54:03 +00:00

Move tenant routes file

This commit is contained in:
Samuel Štancl 2020-05-24 21:10:50 +02:00
parent 5a19f1769e
commit 5eeba43796
3 changed files with 12 additions and 4 deletions

View file

@ -1,6 +1,8 @@
<?php <?php
use Illuminate\Support\Facades\Route;
use Stancl\Tenancy\Middleware\InitializeTenancyByDomain; use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
use Stancl\Tenancy\Middleware\PreventAccessFromCentralDomains;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -8,15 +10,14 @@ use Stancl\Tenancy\Middleware\InitializeTenancyByDomain;
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you can register the tenant routes for your application. | Here you can register the tenant routes for your application.
| These routes are loaded by the TenantRouteServiceProvider | These routes are loaded by the TenantRouteServiceProvider.
| with the namespace configured in your tenancy config.
| |
| Feel free to customize them however you want. Good luck! | Feel free to customize them however you want. Good luck!
| |
*/ */
Route::group([ Route::group([
'middleware' => ['web', InitializeTenancyByDomain::class], 'middleware' => ['web', PreventAccessFromCentralDomains::class, InitializeTenancyByDomain::class],
'prefix' => '/app', 'prefix' => '/app',
], function () { ], function () {
Route::get('/', function () { Route::get('/', function () {

View file

@ -37,7 +37,10 @@ class Install extends Command
$this->info('✔️ Created config/tenancy.php'); $this->info('✔️ Created config/tenancy.php');
if (! file_exists(base_path('routes/tenant.php'))) { if (! file_exists(base_path('routes/tenant.php'))) {
file_put_contents(base_path('routes/tenant.php'), file_get_contents(__DIR__ . '/../../assets/tenant_routes.php.stub')); $this->callSilent('vendor:publish', [
'--provider' => 'Stancl\Tenancy\TenancyServiceProvider',
'--tag' => 'routes',
]);
$this->info('✔️ Created routes/tenant.php'); $this->info('✔️ Created routes/tenant.php');
} else { } else {
$this->info('Found routes/tenant.php.'); $this->info('Found routes/tenant.php.');

View file

@ -91,6 +91,10 @@ class TenancyServiceProvider extends ServiceProvider
__DIR__ . '/../assets/impersonation-migrations/' => database_path('migrations'), __DIR__ . '/../assets/impersonation-migrations/' => database_path('migrations'),
], 'impersonation-migrations'); ], 'impersonation-migrations');
$this->publishes([
__DIR__ . '/../assets/tenant_routes.stub.php' => config_path('tenancy.php'),
], 'routes');
$this->publishes([ $this->publishes([
__DIR__ . '/../assets/TenancyServiceProvider.stub.php' => app_path('Providers/TenancyServiceProvider.php'), __DIR__ . '/../assets/TenancyServiceProvider.stub.php' => app_path('Providers/TenancyServiceProvider.php'),
], 'providers'); ], 'providers');