'home', function() { return View::make('home.index'); })); Route::controller(array( 'auth', 'filter', 'home', 'restful', 'template.basic', 'template.name', 'template.override', 'admin.panel', )); /* |-------------------------------------------------------------------------- | Route Filters |-------------------------------------------------------------------------- | | Filters provide a convenient method for attaching functionality to your | routes. The built-in "before" and "after" filters are called before and | after every request to your application, and you may even create other | filters that can be attached to individual routes. | | Let's walk through an example... | | First, define a filter: | | Filter::register('filter', function() | { | return 'Filtered!'; | }); | | Next, attach the filter to a route: | | Router::register('GET /', array('before' => 'filter', function() | { | return 'Hello World!'; | })); | */ Filter::register('before', function() { $_SERVER['before'] = true; }); Filter::register('after', function() { $_SERVER['after'] = true; }); Filter::register('csrf', function() { if (Request::forged()) return Response::error('500'); }); Filter::register('auth', function() { if (Auth::guest()) return Redirect::to('login'); });