1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 06:54:05 +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,6 +23,7 @@ class UniversalRoutes implements Feature
public function bootstrap(Tenancy $tenancy): void public function bootstrap(Tenancy $tenancy): void
{ {
foreach (static::$identificationMiddlewares as $middleware) { foreach (static::$identificationMiddlewares as $middleware) {
if (is_null($middleware::$onFail)) {
$middleware::$onFail = function ($exception, $request, $next) { $middleware::$onFail = function ($exception, $request, $next) {
if (static::routeHasMiddleware($request->route(), static::$middlewareGroup)) { if (static::routeHasMiddleware($request->route(), static::$middlewareGroup)) {
return $next($request); return $next($request);
@ -32,6 +33,7 @@ class UniversalRoutes implements Feature
}; };
} }
} }
}
public static function routeHasMiddleware(Route $route, $middleware): bool public static function routeHasMiddleware(Route $route, $middleware): bool
{ {