The 404 Error pages should automatically load when you request for a route which doesn't exist.
If somebody request for a resource which doesn't exit, call :
//This should show the 404 Error Page
abort(404);
Hi,
What else do I have to do to make the custom error-views work?
Docs:
Custom HTTP Error Pages Laravel makes it easy to return custom error pages for various HTTP status codes. For example, if you wish to customize the error page for 404 HTTP status codes, create a resources/views/errors/404.blade.php. This file will be served on all 404 errors generated by your application. The views within this directory should be named to match the HTTP status code they correspond to.
So I did this: https://www.dropbox.com/s/v34lmnz9ebt6ono/Schermafdruk%202015-09-17%2014.35.33.png?dl=0
But it isn't working. What else to do? It doesn't work on L5 and L5.1..
As you can see in the file: /Users/x/Code/foobar/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php:
class Handler implements ExceptionHandlerContract
{
/**
* Render the given HttpException.
*
* @param \Symfony\Component\HttpKernel\Exception\HttpException $e
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function renderHttpException(HttpException $e)
{
$status = $e->getStatusCode();
if (view()->exists("errors.{$status}")) {
return response()->view("errors.{$status}", ['exception' => $e], $status);
} else {
return $this->convertExceptionToResponse($e);
}
}
Then a template with the name of 404.blade.php in the errors-folder in the app recourses folder should do the trick. But it doesn't do the trick.
if you put them in resources/views/errors they shoud work ex: resources/views/errors/404.blade.php
OOPS: i find that you are doing it properly...may be some other package over-writing it...
in handler.php, try to return something above that view related code to see whether that part is getting executed or not.
Please or to participate in this conversation.