tldr; 只要您的User模型正确实现了接口,就可以为您的密码字段命名。
但是,您不能将其他数组键传递给该Auth::attempt
方法-只有password
索引可以在那里
首先,您做错了-您需要传递一组凭据作为第一参数:
if (Auth::attempt(Input::only('user_displayName', 'user_password')))接下来,不幸的是,
Eloquentprovider
password在代码中具有硬编码的数组索引,因此您无法传递
user_password给该
attempt方法。
因此,这就是您需要的:
$credentials = Input::only('user_displayName');$credentials['password'] = Input::get('user_password');if (Auth::attempt($credentials))// or simply rename the input in your form to password and:if (Auth::attempt(Input::only('user_displayName', 'password')))


