Commit d26314de authored by Joseph Silber's avatar Joseph Silber

Move the full response logic into the unauthenticated method

parent b069ff0d
...@@ -34,7 +34,11 @@ class Handler extends ExceptionHandler ...@@ -34,7 +34,11 @@ class Handler extends ExceptionHandler
*/ */
protected function unauthenticated($request, AuthenticationException $e) protected function unauthenticated($request, AuthenticationException $e)
{ {
parent::unauthenticated($request, $e); if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('login');
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment