From cedde2d934750ac38c35b257aad6ddeda15eb923 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 26 May 2016 10:00:14 -0500 Subject: [PATCH] cleaning up --- app/Exceptions/Handler.php | 44 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e173d914..280e7e37 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -4,10 +4,6 @@ namespace App\Exceptions; use Exception; use Illuminate\Auth\AuthenticationException; -use Illuminate\Validation\ValidationException; -use Illuminate\Auth\Access\AuthorizationException; -use Illuminate\Database\Eloquent\ModelNotFoundException; -use Symfony\Component\HttpKernel\Exception\HttpException; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler @@ -19,28 +15,12 @@ class Handler extends ExceptionHandler */ protected $dontReport = [ AuthenticationException::class, - AuthorizationException::class, - HttpException::class, - ModelNotFoundException::class, - ValidationException::class, + \Illuminate\Auth\Access\AuthorizationException::class, + \Symfony\Component\HttpKernel\Exception\HttpException::class, + \Illuminate\Database\Eloquent\ModelNotFoundException::class, + \Illuminate\Validation\ValidationException::class, ]; - /** - * Convert an authentication exception into an unauthenticated response. - * - * @param \Illuminate\Http\Request $request - * @param \Illuminate\Auth\AuthenticationException $e - * @return \Symfony\Component\HttpFoundation\Response - */ - protected function unauthenticated($request, AuthenticationException $e) - { - if ($request->ajax() || $request->wantsJson()) { - return response('Unauthorized.', 401); - } else { - return redirect()->guest('login'); - } - } - /** * Report or log an exception. * @@ -65,4 +45,20 @@ class Handler extends ExceptionHandler { return parent::render($request, $e); } + + /** + * Convert an authentication exception into an unauthenticated response. + * + * @param \Illuminate\Http\Request $request + * @param \Illuminate\Auth\AuthenticationException $e + * @return \Illuminate\Http\Response + */ + protected function unauthenticated($request, AuthenticationException $e) + { + if ($request->ajax() || $request->wantsJson()) { + return response('Unauthorized.', 401); + } else { + return redirect()->guest('login'); + } + } }