clean up exception handler
This commit is contained in:
@@ -14,12 +14,7 @@ class Handler extends ExceptionHandler
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $dontReport = [
|
protected $dontReport = [
|
||||||
\Illuminate\Auth\AuthenticationException::class,
|
//
|
||||||
\Illuminate\Auth\Access\AuthorizationException::class,
|
|
||||||
\Symfony\Component\HttpKernel\Exception\HttpException::class,
|
|
||||||
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
|
|
||||||
\Illuminate\Session\TokenMismatchException::class,
|
|
||||||
\Illuminate\Validation\ValidationException::class,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,10 +51,8 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
protected function unauthenticated($request, AuthenticationException $exception)
|
protected function unauthenticated($request, AuthenticationException $exception)
|
||||||
{
|
{
|
||||||
if ($request->expectsJson()) {
|
return $request->expectsJson()
|
||||||
return response()->json(['error' => 'Unauthenticated.'], 401);
|
? response()->json(['error' => 'Unauthenticated.'], 401)
|
||||||
}
|
: redirect()->guest(route('login'));
|
||||||
|
|
||||||
return redirect()->guest(route('login'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user