There are a number of views already created in Blade for when exceptions occur but as you might expect, you can alter these to be just how you require.
Editing the files directly is possible, but there is a better way which only takes a minute.
Let’s start by creating a blank project
> laravel new exceptions
Wait for that to finish and then run the in-built server so that you can see your shiny new website.
> php artisan serve
Great! Now let’s generate an exception. We can do this easily by placing the site into maintenance mode so go ahead and do that now.
> php artisan down
Go back to your home page URL and see the exception being shown in a view.
Now time to change it. Open up the file:
We aren’t going to change this - just select all the text and copy it into the clipboard.
Next, create a file in
503.blade.php. Note, you may have to create the errors folder.
Paste the text in that you copied and alter the message:
Save this and revisit the homepage of your Laravel website. Tada!
Hi! Did you find this useful or interesting? I have an email list coming soon, but in the meantime, if you ready anything you fancy chatting about, I would love to hear from you. You can contact me here or at stephen ‘at’ logicalmoon.com