I searched the "Resources" but did not find, however as this link https://driesvints.com/blog/laravel-4-quick-tip-custom-error-pages you can do so:
App::error(function($exception, $code)
{
$error = array( 'error' => $exception->getMessage());
switch ($code)
{
case 403:
return Response::view('errors.403', $error, 403);
case 404:
return Response::view('errors.404', $error, 404);
case 500:
return Response::view('errors.500', $error, 500);
default:
return Response::view('errors.default', $error, $code);
}
});
Any request where the answer is related to a http
, the Laravel
uses this method App::error
to check if you made any customization for certain error. The way this is done is by checking if there is anything being returned by the closure passed as argument from App::error
. Should he return null
or none
(empty Return), Laravel will use the default error (which is Whoops!).
Remembering that when you set up the error page, the call from App::abort()
is also affected. That is, if you do this...
return App::abort('Acesso não autorizado', 403);
... It will no longer be called error whoops!
, rather what you defined. In this case, the value of the arguments $code
and $exception->getMessage()
will be the values passed to App::abort()
;
That’s right. I’ve already implemented here on the system. If you want to ignore any error, in fact just do not return anything, Laravel uses the standard error.
– Wallace Maxters
@Wallacemaxters got confused about your comment, ignore error and default error.
– Guilherme Nascimento
If you want to ignore a specific http error code, just return null. That’s what I meant.
– Wallace Maxters
@Wallacemaxters thanks for the detailing, I had not gone so deep :)
– Guilherme Nascimento
I’m a fan of Laravel.
– Wallace Maxters