Why aren't you using the basic Auth filter ?
eriktisme said:
Why aren't you using the basic Auth filter ?
How? Do you mean like this?
Route::filter('login_check', function()
{
if(!Auth::Admin())
return Redirect::to('/');
});
I get this:
ErrorException
call_user_func_array() expects parameter 1 to be a valid callback, class 'Illuminate\Auth\Guard' does not have a method 'Admin'
Like you are doing with your login_check
function __construct() {
// echo "Called";
$this->beforeFilter('auth');
}
In filters.php, there's a filter that says:
Route::filter('auth', function()
{
if (Auth::guest()) return Redirect::guest('login');
});
That will let through any person authenticated.
On the other hand, if you want to set up a filter that will only let through people that have not been authenticated, you can use the built in guest filter:
Route::filter('guest', function()
{
if (Auth::check()) return Redirect::to('/');
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community