Move the full response logic into the unauthenticated method
This commit is contained in:
parent
b069ff0d0c
commit
d26314de20
|
@ -34,7 +34,11 @@ class Handler extends ExceptionHandler
|
|||
*/
|
||||
protected function unauthenticated($request, AuthenticationException $e)
|
||||
{
|
||||
parent::unauthenticated($request, $e);
|
||||
if ($request->ajax() || $request->wantsJson()) {
|
||||
return response('Unauthorized.', 401);
|
||||
} else {
|
||||
return redirect()->guest('login');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue