簡體   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