From 3f16be1963cdc9f107176592bb284245606b1ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Tue, 15 Oct 2019 20:02:09 +0200 Subject: [PATCH] Add the PreventAccess MW to tenant routes by default --- src/Commands/Install.php | 3 +++ tests/Etc/modifiedHttpKernel.stub | 1 + 2 files changed, 4 insertions(+) diff --git a/src/Commands/Install.php b/src/Commands/Install.php index 7fd0b670..aff51754 100644 --- a/src/Commands/Install.php +++ b/src/Commands/Install.php @@ -47,6 +47,9 @@ class Install extends Command $newKernel = str_replace("'web' => [", "'web' => [ \Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class,", $newKernel); + $newKernel = str_replace("'api' => [", "'api' => [ + \Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class,", $newKernel); + file_put_contents(app_path('Http/Kernel.php'), $newKernel); $this->info('✔️ Set middleware priority'); diff --git a/tests/Etc/modifiedHttpKernel.stub b/tests/Etc/modifiedHttpKernel.stub index 86cf535c..0de76bbd 100644 --- a/tests/Etc/modifiedHttpKernel.stub +++ b/tests/Etc/modifiedHttpKernel.stub @@ -39,6 +39,7 @@ class Kernel extends HttpKernel ], 'api' => [ + \Stancl\Tenancy\Middleware\PreventAccessFromTenantDomains::class, 'throttle:60,1', 'bindings', ],