I would suggest putting this in your app/start/global.php , since that is where Laravel handles it by default (although filters.php will also work). I usually use something like this:
App::error(function(Exception $exception, $code) { $pathInfo = Request::getPathInfo(); $message = $exception->getMessage() ?: 'Exception'; Log::error("$code - $message @ $pathInfo\r\n$exception"); if (Config::get('app.debug')) { return; } switch ($code) { case 403: return Response::view('errors/403', array(), 403); case 500: return Response::view('errors/500', array(), 500); default: return Response::view('errors/404', array(), $code); } });
Then just create the errors folder inside /views and place the contents of the error page there. As Antonio noted, you can pass data inside array() .
I kindly took this method from https://github.com/andrewelkins/Laravel-4-Bootstrap-Starter-Site
Josh mountain
source share