Laravel 4 Laravel:身份验证尝试失败

Laravel 4 Laravel:身份验证尝试失败,laravel-4,Laravel 4,我尝试了以下代码。但身份验证尝试失败 // validate the info, create rules for the inputs $rules = array( 'email' => 'required|email', // make sure the email is an actual email 'password' => 'required|alphaNum|min:3' // password can only be a

我尝试了以下代码。但身份验证尝试失败

// validate the info, create rules for the inputs
    $rules = array(
        'email'    => 'required|email', // make sure the email is an actual email
        'password' => 'required|alphaNum|min:3' // password can only be alphanumeric and has to be greater than 3 characters
    );

    // run the validation rules on the inputs from the form
    $validator = Validator::make(Input::all(), $rules);

    // if the validator fails, redirect back to the form
    if ($validator->fails()) {
        return Redirect::to('login')
            ->withErrors($validator) // send back all errors to the login form
            ->withInput(Input::except('password')); // send back the input (not the password) so that we can repopulate the form
    } else {

        // create our user data for the authentication
        $userdata = array(
            'Email'     => Input::get('email'),
            'Password'  => Input::get('password')
        );

        // attempt to do the login
        if (Auth::attempt($userdata)) {
            // validation successful!
            // redirect them to the secure section or whatever
            // return Redirect::to('secure');
            // for now we'll just echo success (even though echoing in a controller is bad)
            echo 'SUCCESS!';
        } else {
            // validation not successful, send back to form
            return Redirect::to('login')->with('message', 'Login Failed');
        }

    }
我在Users表中有以下列

身份证, 用户名, 电子邮件, 创建于, 更新地址:, 密码


我已更改模型中的表名。请给我一些建议。怎么了?

通常惯例是将数据库列设置为小写。对于电子邮件专栏,这应该不是问题。如文档所述,
'email'
字段仅用作示例

要使Laravel使用大写密码列。打开您的用户雄辩模型并更改:

public function getAuthPassword()
{
    return $this->password;
}
致:


非常肯定这会奏效,

我找到了一个解决方案。根据巴斯蒂安的建议,我将所有列都改为小写。现在,它正在工作。:)谢谢..我发现Auth::check()方法存在另一个问题。我首先做了Auth::trunt()。然后我检查Auth::check(),但它返回false。为什么?请给我一些建议。
public function getAuthPassword()
{
    return $this->Password;
}