In your resources/views/errors folder, create a file called 500.blade.php .
Laravel makes it easy to display custom error pages for various HTTP protocol status codes. For example, if you want to set up an error page for 500 HTTP status codes, create resources/views/errors/500.blade.php . This file will be serviced on all 500 errors created by your application.
The problem is that Laravel will only automatically render error pages for exceptions that are HttpException instances. Unfortunately, when your server throws an error (the method does not exist, the variable is undefined, etc.), it actually throws a FatalErrorException . This way it doesn't open and flows to SymfonyDisplayer() , which either gives you a trace (debug true) or the ugly single-line "Whoops, something seems to go wrong" (debug false).
To solve this problem, add this to your render method in app/Exceptions/Handler
# /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) { return response()->view('errors.' . $statusCode, [], $statusCode); }
Docs
source share