当前位置: 首页>>代码示例>>PHP>>正文


PHP Handler::render方法代码示例

本文整理汇总了PHP中Laravel\Lumen\Exceptions\Handler::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Handler::render方法的具体用法?PHP Handler::render怎么用?PHP Handler::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Laravel\Lumen\Exceptions\Handler的用法示例。


在下文中一共展示了Handler::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * 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) {
         return response()->json(['error' => ['message' => 'Resource Not Found!', 'code' => 404]], 404);
     }
     return parent::render($request, $e);
 }
开发者ID:GreenHackers,项目名称:geo-endpoint,代码行数:14,代码来源:Handler.php

示例2: render

 /**
  * 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 HookBotException) {
         return response()->json($e->getPayload(), $e->getErrorCode());
     }
     return parent::render($request, $e);
 }
开发者ID:jshayes,项目名称:hookbot,代码行数:14,代码来源:Handler.php

示例3: render

 /**
  * 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 (!env('APP_DEBUG') and $this->isHttpException($e)) {
         return $this->renderHttpException($e);
     }
     return parent::render($request, $e);
 }
开发者ID:coseyo,项目名称:lumen,代码行数:14,代码来源:Handler.php

示例4: render

 /**
  * 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 \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
         return view('home');
     }
     return parent::render($request, $e);
 }
开发者ID:jrenton,项目名称:volumio,代码行数:14,代码来源:Handler.php

示例5: render

 /**
  * 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 NotFoundHttpException || $e instanceof ModelNotFoundException || $e instanceof MethodNotAllowedHttpException) {
         return response()->json(['error' => ['message' => 'Not found', 'status_code' => 404]], 404);
     }
     return parent::render($request, $e);
 }
开发者ID:nerdify,项目名称:Saldo-TUC-API,代码行数:15,代码来源:Handler.php

示例6: render

 /**
  * 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) {
         return response()->json('Not found.', 404);
     }
     return parent::render($request, $e);
 }
开发者ID:edcoreweb,项目名称:dominox,代码行数:14,代码来源:Handler.php

示例7: render

 /**
  * 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 AbstractAppException) {
         return $e->response($request);
     }
     return parent::render($request, $e);
 }
开发者ID:shaunpersad,项目名称:reflect-api,代码行数:14,代码来源:Handler.php

示例8: render

 /**
  * 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 HttpException) {
         return view('errors/404');
     }
     return parent::render($request, $e);
 }
开发者ID:ssddanbrown,项目名称:BookStack-Site,代码行数:14,代码来源:Handler.php

示例9: render

 /**
  * 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 NotFoundHttpException) {
         return view('missing');
     }
     return parent::render($request, $e);
 }
开发者ID:penoonan,项目名称:giving-circle,代码行数:14,代码来源:Handler.php

示例10: render

 /**
  * 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 BadRequestHttpException) {
         return response()->json(['success' => false, 'errors' => ['Please provide a token']], 400);
     }
     return parent::render($request, $e);
 }
开发者ID:rajabishek,项目名称:begin,代码行数:14,代码来源:Handler.php

示例11: render

 /**
  * 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 TokenMismatchException) {
         return view('error.error');
     }
     return parent::render($request, $e);
 }
开发者ID:thebhandariprakash,项目名称:LumenAuthentication,代码行数:14,代码来源:Handler.php

示例12: render

 /**
  * 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)
 {
     $this->response = app(Response::class);
     // Model not found
     if ($e instanceof ModelNotFoundException) {
         return $this->response->errorNotFound(['title' => 'No query results', 'code' => Error::CODE_RESOURCE_NOT_FOUND]);
     }
     // Wrongs argument
     if ($e instanceof InvalidArgumentException) {
         return $this->response->errorWrongArgs([$e->getMessage()]);
     }
     // Validator
     if ($e instanceof ValidatorException) {
         return $this->response->errorWrongArgsValidator($e->errors());
     }
     if ($e instanceof AuthorizationException) {
         return $this->response->errorUnauthorized([$e->getMessage()]);
     }
     // Route not found
     if ($e instanceof NotFoundHttpException) {
         return $this->response->errorNotFound();
     }
     //  Method not allowed
     if ($e instanceof MethodNotAllowedHttpException) {
         return $this->response->errorMethodNotAllowed();
     }
     if ($e instanceof InvalidRequestException) {
         return $this->response->errorUnauthorized([$e->getMessage()]);
     }
     if ($e instanceof AccessDeniedException) {
         return $this->response->errorUnauthorized([$e->getMessage()]);
     }
     return parent::render($request, $e);
 }
开发者ID:ellipsesynergie,项目名称:backend-skeleton,代码行数:41,代码来源:Handler.php

示例13: render

 /**
  * 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 instanceof NotFoundHttpException) {
         return view('errors.404');
     }
     return parent::render($request, $e);
 }
开发者ID:MikeMcMullan,项目名称:simple-url-shortener,代码行数:14,代码来源:Handler.php

示例14: render

 /**
  * 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) {
         return new Response(view('admin::errors.404'), 404);
     }
     return parent::render($request, $e);
 }
开发者ID:Ognestraz,项目名称:lumen-admin,代码行数:14,代码来源:Handler.php

示例15: render

 /**
  * 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 NotFoundHttpException) {
         return redirect('/#/' . $request->path());
     }
     return parent::render($request, $e);
 }
开发者ID:Munk91,项目名称:Hovedopgave,代码行数:14,代码来源:Handler.php


注:本文中的Laravel\Lumen\Exceptions\Handler::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。