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

bug: added null check on middleware onFail in UniversalRoutes

This commit is contained in:
Noah Wilderom 2024-04-26 15:50:56 +02:00 committed by GitHub
parent 4dab0c1870
commit 89be25a3af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,13 +23,15 @@ class UniversalRoutes implements Feature
public function bootstrap(Tenancy $tenancy): void
{
foreach (static::$identificationMiddlewares as $middleware) {
$middleware::$onFail = function ($exception, $request, $next) {
if (static::routeHasMiddleware($request->route(), static::$middlewareGroup)) {
return $next($request);
}
if (is_null($middleware::$onFail)) {
$middleware::$onFail = function ($exception, $request, $next) {
if (static::routeHasMiddleware($request->route(), static::$middlewareGroup)) {
return $next($request);
}
throw $exception;
};
throw $exception;
};
}
}
}