I want to create a custom error page for 4xx http status codes (eg. 404, 400, ...). But I need the whole $app context, since I want to display my header, footer and a search field.
I have read a lot about the custom solutions in the app/start/global.php file, but this does not help. Its good for the 5xx status codes, since I do not need the $app context there (in most cases I couldn't be accessed anyways, if there was a 500).
This is fine for the 5xx:
App::error(function(Exception $exception, $code)
{
if (App::isDownForMaintenance()) {
return Response::make("Maintenance, brb.", 503);
}
if (Config::get('app.debug')) return;
switch ($code)
{
case 500: /* internal error */
default:
return View::make('_layouts.error_500');
}
});
But how can I create a 4xx custom page with $app in Laravel?
My Laravel Version is: 4.2.x