comment('Installing stancl/tenancy...'); $this->callSilent('vendor:publish', [ '--provider' => 'Stancl\Tenancy\TenancyServiceProvider', '--tag' => 'config', ]); $this->info('✔️ Created config/tenancy.php'); $newKernel = str_replace( 'protected $middlewarePriority = [', "protected \$middlewarePriority = [ \Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class, \Stancl\Tenancy\Middleware\InitializeTenancy::class,", file_get_contents(app_path('Http/Kernel.php')) ); $newKernel = str_replace("'web' => [", "'web' => [ \Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class,", $newKernel); file_put_contents(app_path('Http/Kernel.php'), $newKernel); $this->info('✔️ Set middleware priority'); file_put_contents( base_path('routes/tenant.php'), "info('✔️ Created routes/tenant.php'); $this->line(''); $this->line("This package lets you store data about tenants either in Redis or in a relational database like MySQL. If you're going to use the database storage, you need to create a tenants table."); if ($this->confirm('Do you want to publish the default database migrations?', true)) { $this->callSilent('vendor:publish', [ '--provider' => 'Stancl\Tenancy\TenancyServiceProvider', '--tag' => 'migrations', ]); $this->info('✔️ Created migrations. Remember to run [php artisan migrate]!'); } if (! is_dir(database_path('migrations/tenant'))) { mkdir(database_path('migrations/tenant')); $this->info('✔️ Created database/migrations/tenant folder.'); } $this->comment('✨️ stancl/tenancy installed successfully.'); } }