mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 23:04:03 +00:00
feat(UniversalRoutes): Stop overwriting the (maybe) customized onFail method and just call it in case of an exception
This commit is contained in:
parent
1a5300ab4f
commit
8fb3eb0abd
1 changed files with 4 additions and 2 deletions
|
|
@ -23,12 +23,14 @@ class UniversalRoutes implements Feature
|
|||
public function bootstrap(Tenancy $tenancy): void
|
||||
{
|
||||
foreach (static::$identificationMiddlewares as $middleware) {
|
||||
$middleware::$onFail = function ($exception, $request, $next) {
|
||||
$originalOnFail = $middleware::$onFail;
|
||||
|
||||
$middleware::$onFail = function ($exception, $request, $next) use ($originalOnFail) {
|
||||
if (static::routeHasMiddleware($request->route(), static::$middlewareGroup)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
throw $exception;
|
||||
return $originalOnFail($exception, $request, $next);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue