view('layouts.errors.404', [], 404); } elseif ($exception instanceof HttpException && $exception->getStatusCode() == 403) { return response()->view( 'layouts.errors.403', ['error' => 'Sorry, this page is restricted to authorized users only.'], 403 ); } elseif ($exception instanceof HttpException) { Log::info($exception->getMessage()); return response()->view('layouts.errors.503', ['error' => $exception->getTrace()], 500); } return parent::render($request, $exception); } /** * Convert an authentication exception into an unauthenticated response. * * @param \Illuminate\Http\Request $request * @param \Illuminate\Auth\AuthenticationException $exception * @return \Illuminate\Http\Response */ protected function unauthenticated($request, AuthenticationException $exception) { if ($request->expectsJson()) { return response()->json(['error' => 'Unauthenticated.'], 401); } return redirect()->guest(route('login')); } }