Reputation: 541
I want to make a custom 404 error page to show on production with Laravel. But I don't know wich file do I have to edit or if I have to create a new one and where do I have to create it?
All I have found is related to handling errors but that's not what I want.
What I mean is that I want to show something like this:
Thanks in advanced!
Upvotes: 0
Views: 945
Reputation: 1206
You can override Laravel's handling of errors in app/start/global.php
Look for App::error
and replace it with :
App::error(function(Exception $exception, $code)
{
Log::error($exception);
if ( ! in_array($code,array(401,403,404,500))){
return;
}
$data = array('code'=> $code);
switch ($code) {
case 403:
return Response::view('errors.error', $data, $code);
break;
case 404:
return Response::view('errors.error', $data, $code);
break;
}
});
You can then specify custom views for errors based on the error code.
Upvotes: 3