I totally agree with everyone who wants to tweak the bugs in Laravel so their users never see an embarrassing message such as "Oops, something seems to have gone wrong."
It took me a while to figure this out.
How to set up Oops message in Laravel 5.3
In app/Exceptions/Handler.php replace the entire prepareResponse function with this:
protected function prepareResponse($request, Exception $e) { if ($this->isHttpException($e)) { return $this->toIlluminateResponse($this->renderHttpException($e), $e); } else { return response()->view("errors.500", ['exception' => $e]);
Basically, it is almost identical to the original functions, but you just change the else block to render the view.
In /resources/views/errors create 500.blade.php .
You can write any text you want there, but I always recommend keeping the error pages very simple (pure HTML and CSS and nothing unusual), so there is almost a zero chance that they themselves can cause additional errors.
To check that it works
In routes/web.php you can add:
Route::get('error500', function () { throw new \Exception('TEST PAGE. This simulated error exception allows testing of the 500 error page.'); });
Then I will go to mysite.com/error500 and see if you see your page with the modified error.
Then also go to mysite.com/some-nonexistent-route and see if you all got the 404 page that you customized, if you have one.
source share