isHttpException($exception)) { if($request->segment(1) == 'admin'){ if (view()->exists('admin.errors.' . $exception->getStatusCode())) { return response()->view('admin.errors.' . $exception->getStatusCode(), [], $exception->getStatusCode()); } }else{ if (view()->exists('errors.' . $exception->getStatusCode())) { return response()->view('errors.' . $exception->getStatusCode(), [], $exception->getStatusCode()); } } } if ($exception instanceof TokenMismatchException) { if($request->segment(1) == 'admin'){ Auth::guard('admin')->logout(); return redirect(route('admin.login'))->with('error', 'Page session expired. Please try again'); } } return parent::render($request, $exception); } }