2014-05-04 61 views
0

我有Laravel认证系统的一个问题:Laravel 4验证尝试()失败

$credentials = array(
    'email' => Input::get('email'), 
    'password' => Input::get('password'), 
    'active' => 1 
); 

if(Auth::attempt($credentials)){ 
    echo "fine"; 
}else{ 
    echo "fail"; 
} 

Auth::attempt()总是返回false。

因此,我试图用其它方法进行验证:

$user = User::where('email','=',Input::get('email'))->firstOrFail(); 
if ($user->active && Hash::check(Input::get('password'), $user->password)){ 
    echo "fine"; 
}else{ 
    echo "fail"; 
} 

这一个工程。

你知道什么可能使attempt方法无效吗?

回答