1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-04 22:04:03 +00:00

Skip ScopeSessions MW if the current context is central and the route is universal

This commit is contained in:
lukinovec 2025-04-03 15:48:42 +02:00
parent 8cd15db1fc
commit a6df4e526e

View file

@ -19,6 +19,12 @@ class ScopeSessions
public function handle(Request $request, Closure $next): mixed public function handle(Request $request, Closure $next): mixed
{ {
if (! tenancy()->initialized) { 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'); throw new TenancyNotInitializedException('Tenancy needs to be initialized before the session scoping middleware is executed');
} }