Laravel 4 Auth失败了

时间:2014-05-12 08:23:53

标签: php laravel-4

我尝试过这款Laravel Auth,但每次都会返回'no'。

$logging_user = array(
    'user_name' => 'abcde',
    'user_password'=> Hash::make('11111')
);

if (Auth::attempt($logging_user)) {
     return 'yes';
}
else {
     return 'no';
}

我的表结构是这样的

users {
    id,
    user_name,
    user_password,
    user_email
}

我的模型User.php已经实现了UserInterface

//inherited
public function getAuthIdentifier() {
    return $this->getKey();
}

//inherited
public function getAuthPassword() {
    return $this->user_password;
}

//inherited
public function getReminderEmail() {
    return $this->user_email;
}

1 个答案:

答案 0 :(得分:0)

我通过更改

意外修复了它
$logging_user = array(
    'user_name' => 'abcde',
    'user_password'=> Hash::make('11111')
);

$logging_user = array(
    'user_name' => 'abcde',
    'password'=> Hash::make('11111')
);