繁体   English   中英

Laravel中的身份验证问题

[英]Problems with authentication in laravel

我更改了用户表。 它与上一个表“ panel_users”完美配合,我在用户模型中将表更改为“ admins”:

protected $table    = 'admins';    

并在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',

最后,问题出在导入表中。 我已经通过迁移将其重写,现在一切正常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM