laravel中的身份验证问题


Problems with authentication in laravel

我修改了我的users表。它与之前的表"panel_users"完美地工作,我在用户模型中将表更改为"admins":

protected $table    = 'admins';    

and in AuthController:

return Validator::make($data, [
    'name' => 'required|max:255',
    'email' => 'required|email|max:255|unique:admins',
    'password' => 'required|min:6|confirmed'
]);

注册工作正常,但当我尝试使用正确的凭据登录时,页面刷新和错误"这些凭据不匹配我们的记录"发生。

表'admins'与我之前的表有相同的字段,还有一些额外的字段。

正如@Loek所说,您还需要更改config/auth.php文件:

/*
|--------------------------------------------------------------------------
| Authentication Table
|--------------------------------------------------------------------------
|
| When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic
| default value but you may easily change it to any table you like.
|
*/
'table' => 'users',

最后,问题出在导入的表中。我用迁移重写了它,现在一切都正常了。