示例#1
0
文件: Handler.php 项目: faycal1/Ball
 /**
  * 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());
     }
     if ($e instanceof Ball\ModelNotFoundException) {
         return redirect()->back()->withInput()->withFlashDanger($e->modelErrors('Action Reported'));
     }
     //Catch all
     return parent::render($request, $e);
 }