From a6df4e526ee9faf692143d08a4a4c87a480c20fe Mon Sep 17 00:00:00 2001 From: lukinovec Date: Thu, 3 Apr 2025 15:48:42 +0200 Subject: [PATCH] Skip ScopeSessions MW if the current context is central and the route is universal --- src/Middleware/ScopeSessions.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Middleware/ScopeSessions.php b/src/Middleware/ScopeSessions.php index 46bd5dc4..19081033 100644 --- a/src/Middleware/ScopeSessions.php +++ b/src/Middleware/ScopeSessions.php @@ -19,6 +19,12 @@ class ScopeSessions public function handle(Request $request, Closure $next): mixed { if (! tenancy()->initialized) { + $route = tenancy()->getRoute($request); + + if (tenancy()->routeIsUniversal($route)) { + return $next($request); + } + throw new TenancyNotInitializedException('Tenancy needs to be initialized before the session scoping middleware is executed'); }