I searched for the "resources" but did not find it, however this link link you can do this:
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 response is related to an error of http
, Laravel
uses this App::error
method to verify that you have made some customization for a given error. The way this is done is to check if there is anything being returned by the past closure as the App::error
argument. If you return null
or none
(return empty), Laravel will use the default error (which is whoops!).
Remembering that when you set up the error page, the App::abort()
call is also affected. That is, if you do this ...
return App::abort('Acesso não autorizado', 403);
... It will no longer be called the whoops!
error, but rather what you have defined. In this case, the value of the arguments $code
and $exception->getMessage()
will be the values passed to App::abort()
;