Skip to content

Instantly share code, notes, and snippets.

@agborkowski
Created July 5, 2011 10:02
Show Gist options
  • Save agborkowski/1064588 to your computer and use it in GitHub Desktop.
Save agborkowski/1064588 to your computer and use it in GitHub Desktop.
Dispatcher::applyFilter('_callable', function($self, $params, $chain) {
$ctrl = $chain->next($self, $params, $chain);
if (Auth::check('default')) {
return $ctrl;
}
if (isset($ctrl->publicActions) && in_array($params['params']['action'], $ctrl->publicActions)) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return $ctrl;
}
if(!isset($request))
$request = $params['request'];
^^^^^^^^^^^^^^^^^^^^^^
return function() use ($request) {
return new Response(compact('request') + array('location' => '/users/login'));
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment