|
@@ -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');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|