From b611f10db72640c53da8f5e45a1050e7e6bd5678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Fri, 23 Aug 2019 12:42:01 +0200 Subject: [PATCH] Install command --- src/Commands/Install.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Commands/Install.php b/src/Commands/Install.php index d05495b3..408d4213 100644 --- a/src/Commands/Install.php +++ b/src/Commands/Install.php @@ -34,11 +34,18 @@ class Install extends Command ]); $this->info('✔️ Created config/tenancy.php'); - \file_put_contents(app_path('Http/Kernel.php'), \str_replace( + $newKernel = \str_replace( 'protected $middlewarePriority = [', - "protected \$middlewarePriority = [\n \Stancl\Tenancy\Middleware\InitializeTenancy::class,", + "protected \$middlewarePriority = [ + \Stancl\Tenancy\Middleware\InitializeTenancy::class, + \Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::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(