Pattern filters in Laravel 4

Posted by ali A on Stack Overflow See other posts from Stack Overflow or by ali A
Published on 2013-10-19T15:49:40Z Indexed on 2013/10/19 15:53 UTC
Read the original article Hit count: 287

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about php

Related posts about routes