add facade for filter::register.
This commit is contained in:
parent
479b3f6773
commit
14c9d38270
|
@ -91,22 +91,22 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Filter::register('before', function()
|
Route::filter('before', function()
|
||||||
{
|
{
|
||||||
// Do stuff before every request to your application...
|
// Do stuff before every request to your application...
|
||||||
});
|
});
|
||||||
|
|
||||||
Filter::register('after', function()
|
Route::filter('after', function()
|
||||||
{
|
{
|
||||||
// Do stuff after every request to your application...
|
// Do stuff after every request to your application...
|
||||||
});
|
});
|
||||||
|
|
||||||
Filter::register('csrf', function()
|
Route::filter('csrf', function()
|
||||||
{
|
{
|
||||||
if (Request::forged()) return Response::error('500');
|
if (Request::forged()) return Response::error('500');
|
||||||
});
|
});
|
||||||
|
|
||||||
Filter::register('auth', function()
|
Route::filter('auth', function()
|
||||||
{
|
{
|
||||||
if (Auth::guest()) return Redirect::to('login');
|
if (Auth::guest()) return Redirect::to('login');
|
||||||
});
|
});
|
|
@ -337,4 +337,16 @@ public static function secure($method, $route, $action)
|
||||||
Router::secure($method, $route, $action);
|
Router::secure($method, $route, $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a route filter.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
* @param Closure $callback
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function filter($name, Closure $callback)
|
||||||
|
{
|
||||||
|
Filter::register($name, $callback);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue