Example #1
0
 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request    $request
  * @param  \Exception                  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof ModelNotFoundException) {
         $e = new NotFoundHttpException($e->getMessage(), $e);
     }
     //As to preserve the catch all
     if ($e instanceof GeneralException) {
         return redirect()->back()->withInput()->withFlashDanger($e->getMessage());
     }
     if ($e instanceof Backend\Access\User\UserNeedsRolesException) {
         return redirect()->route('admin.access.users.edit', $e->userID())->withInput()->withFlashDanger($e->validationErrors());
     }
     //Catch all
     return parent::render($request, $e);
 }