Skip to content

Instantly share code, notes, and snippets.

@adampatterson
Last active April 23, 2019 12:36
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adampatterson/e86ac67d321932ecd787f060ae6bdb81 to your computer and use it in GitHub Desktop.
Save adampatterson/e86ac67d321932ecd787f060ae6bdb81 to your computer and use it in GitHub Desktop.
Laravel 5.2 custom 500 error page
# /app/Exceptions/Handler.php
# use Symfony\Component\Debug\Exception\FlattenException;
# public function render($request, Exception $e)
$exception = FlattenException::create($e);
$statusCode = $exception->getStatusCode($exception);
if ($statusCode === 404 or $statusCode === 500 and app()->environment() == 'production') {
return response()->view('errors.' . $statusCode, [], $statusCode);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment