Pattern filters in Laravel 4
- by ali A
I want to make a pattern route, to redirect users to login page when they are not logged in.
I searched but couldn't find a solution. as always Laravel's Documentation is useless!
I have this in my filter.php
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::guest('login');
});
Route::filter('auth.basic', function()
{
return Auth::basic();
});
And this route in my routes.php
Route::when('/*', 'auth' );
but It's not working. How can I do that?