我有一个关于Laravel内置用户认证功能的问题。我已经让认证部分正常工作,但似乎用户并没有存储在会话中。
Route::get('login', function(){
$username = 'stardriver';
$password = '1234';
$creds = array('username' => $username, 'password' => $password);
if(Auth::attempt($creds)){ //I assume that its already logged in when it goes here
return Auth::guest(); //but why does this return 1?
}else{
return 'nope wrong creds'; //if I change the username or password declared above, it goes here
}
});
这是我的管理页面。当用户成功验证后,我重定向到此页面时会出现无限循环。
Route::get('admin', array('before' => 'auth', 'do' => function(){
return "you are logged in! " . HTML::link('logout', 'logout dude');
}));
你认为这里有什么问题?