mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-15 00:04:04 +00:00
Clean up
This commit is contained in:
parent
cbaa775876
commit
c9903cd43c
19 changed files with 212 additions and 215 deletions
|
|
@ -36,21 +36,21 @@ class Install extends Command
|
|||
]);
|
||||
$this->info('✔️ Created config/tenancy.php');
|
||||
|
||||
$newKernel = \str_replace(
|
||||
$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'))
|
||||
file_get_contents(app_path('Http/Kernel.php'))
|
||||
);
|
||||
|
||||
$newKernel = \str_replace("'web' => [", "'web' => [
|
||||
$newKernel = str_replace("'web' => [", "'web' => [
|
||||
\Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class,", $newKernel);
|
||||
|
||||
\file_put_contents(app_path('Http/Kernel.php'), $newKernel);
|
||||
file_put_contents(app_path('Http/Kernel.php'), $newKernel);
|
||||
$this->info('✔️ Set middleware priority');
|
||||
|
||||
\file_put_contents(
|
||||
file_put_contents(
|
||||
base_path('routes/tenant.php'),
|
||||
"<?php
|
||||
|
||||
|
|
@ -82,8 +82,8 @@ Route::get('/', function () {
|
|||
$this->info('✔️ Created migration.');
|
||||
}
|
||||
|
||||
if (! \is_dir(database_path('migrations/tenant'))) {
|
||||
\mkdir(database_path('migrations/tenant'));
|
||||
if (! is_dir(database_path('migrations/tenant'))) {
|
||||
mkdir(database_path('migrations/tenant'));
|
||||
$this->info('✔️ Created database/migrations/tenant folder.');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class Run extends Command
|
|||
|
||||
$callback = function ($prefix = '') {
|
||||
return function ($arguments, $argument) use ($prefix) {
|
||||
[$key, $value] = \explode('=', $argument, 2);
|
||||
[$key, $value] = explode('=', $argument, 2);
|
||||
$arguments[$prefix . $key] = $value;
|
||||
|
||||
return $arguments;
|
||||
|
|
@ -47,13 +47,13 @@ class Run extends Command
|
|||
};
|
||||
|
||||
// Turns ['foo=bar', 'abc=xyz=zzz'] into ['foo' => 'bar', 'abc' => 'xyz=zzz']
|
||||
$arguments = \array_reduce($this->option('argument'), $callback(), []);
|
||||
$arguments = array_reduce($this->option('argument'), $callback(), []);
|
||||
|
||||
// Turns ['foo=bar', 'abc=xyz=zzz'] into ['--foo' => 'bar', '--abc' => 'xyz=zzz']
|
||||
$options = \array_reduce($this->option('option'), $callback('--'), []);
|
||||
$options = array_reduce($this->option('option'), $callback('--'), []);
|
||||
|
||||
// Run command
|
||||
$this->call($this->argument('commandname'), \array_merge($arguments, $options));
|
||||
$this->call($this->argument('commandname'), array_merge($arguments, $options));
|
||||
|
||||
tenancy()->endTenancy();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue