Last active
June 30, 2017 20:00
-
-
Save mbpcoder/a6a2b82c03df337020ca987eae534dbb to your computer and use it in GitHub Desktop.
My render function in Laravel exception Handler Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function render($request, Exception $exception) | |
| { | |
| $statusCode = 0; | |
| if ($this->isHttpException($exception)) { | |
| $statusCode = $exception->getStatusCode(); | |
| } | |
| if (in_array($statusCode, [401, 403, 404, 503])) { | |
| return $this->renderHttpException($exception); | |
| } elseif (app()->environment() == 'production') { | |
| // Custom error 500 view on production | |
| return response()->view("errors.general"); | |
| } | |
| return parent::render($request, $exception); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment