function() | { | return 'Filtered!'; | } | | Next, attach the filter to a route: | | 'GET /' => array('before' => 'simple_filter', function() | { | return 'Hello World!'; | }) | | Now every requests to http://example.com will return "Filtered!", since | the filter is overriding the route action by returning a value. | | To make your life easier, we have built authentication and CSRF filters | that are ready to attach to your routes. Enjoy. | */ 'before' => function() { // Do stuff before every request to your application. }, 'after' => function($response) { // Do stuff after every request to your application. }, 'auth' => function() { if (Auth::guest()) return Redirect::to_login(); }, 'csrf' => function() { if (Request::forged()) return Response::error('500'); }, );