From 4dab0c1870ef5731230e08cdfb5386bcfa502209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sun, 14 Apr 2024 10:12:18 +0200 Subject: [PATCH] defer tenant route registration in TSP stub --- assets/TenancyServiceProvider.stub.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/TenancyServiceProvider.stub.php b/assets/TenancyServiceProvider.stub.php index 1d15f4181..d94703cd5 100644 --- a/assets/TenancyServiceProvider.stub.php +++ b/assets/TenancyServiceProvider.stub.php @@ -120,10 +120,12 @@ protected function bootEvents() protected function mapRoutes() { - if (file_exists(base_path('routes/tenant.php'))) { - Route::namespace(static::$controllerNamespace) - ->group(base_path('routes/tenant.php')); - } + $this->app->booted(function () { + if (file_exists(base_path('routes/tenant.php'))) { + Route::namespace(static::$controllerNamespace) + ->group(base_path('routes/tenant.php')); + } + }); } protected function makeTenancyMiddlewareHighestPriority()