Laravel 5 is wonderful for handling errors. Creating custom error pages is easy too. You can find one default 500 error page (the one you’ll see when turning your app in maintenance with php artisan down (put it back up with php artisan up) in /ressources/views/errors/500.blade.php. Here is how to create some other ones :
Custom 404 page
- Create a new file under :
/ressources/views/errors/404.blade.php
- Customize it. Don’t forget to make it fun ! Here are some cool examples.
Custom 503 page
This one is a bit trickier. By default, Laravel 5 will only load your custom page for HttpException errors.
- Open app/Exceptions/Handler.php
- Modify the render() function like that :
public function render($request, Exception $e) { if (!$this->isHttpException($e)) $e = new \Symfony\Component\HttpKernel\Exception\HttpException(500); return parent::render($request, $e); }
- Then create your new file under /ressources/views/errors/503.blade.php and customize it. Laravel will now redirect all 500 errors to your custom 503 error page.
Thank you so much. Its working perfectly .