mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 18:04:03 +00:00
Laravel 7 support (#304)
* Laravel 7 support * Remove language from travis.yml * Fix travis.yml * Consistent indentation in travis.yml * Use dev-master for phpcov * Cleanup * switch up envs * verify both laravel versions are used * 6 -> 7 * Fix travis yml * Use stable phpcov * Different installation for Laravel 7 * Indentation * Fix dockerfile * Fix indentation * Fix tests * Remove fail() calls
This commit is contained in:
parent
526f0826a4
commit
30bab68b6a
9 changed files with 218 additions and 37 deletions
|
|
@ -36,13 +36,7 @@ class Install extends Command
|
|||
]);
|
||||
$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 = $this->setMiddlewarePriority();
|
||||
|
||||
$newKernel = str_replace("'web' => [", "'web' => [
|
||||
\Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class,", $newKernel);
|
||||
|
|
@ -77,4 +71,34 @@ class Install extends Command
|
|||
|
||||
$this->comment('✨️ stancl/tenancy installed successfully.');
|
||||
}
|
||||
|
||||
protected function setMiddlewarePriority(): string
|
||||
{
|
||||
if (app()->version()[0] === '6') {
|
||||
return str_replace(
|
||||
'protected $middlewarePriority = [',
|
||||
"protected \$middlewarePriority = [
|
||||
\Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class,
|
||||
\Stancl\Tenancy\Middleware\InitializeTenancy::class,",
|
||||
file_get_contents(app_path('Http/Kernel.php'))
|
||||
);
|
||||
} else {
|
||||
return str_replace(
|
||||
"];\n}",
|
||||
"];\n\n protected \$middlewarePriority = [
|
||||
\Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class,
|
||||
\Stancl\Tenancy\Middleware\InitializeTenancy::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,
|
||||
\Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
\Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\Illuminate\Auth\Middleware\Authorize::class,
|
||||
];
|
||||
}",
|
||||
file_get_contents(app_path('Http/Kernel.php'))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue