我需要修改默認登錄名(電子郵件和密碼)。我必須使用電子郵件以外的欄位進行登錄
用戶模型:
protected $fillable = [
'name',
'email',
't_matricula',
'matricula',
'number',
'password',
];
我可以使用數字欄位作為登錄資料,我應該在哪里修改以使用數字而不是名稱?
uj5u.com熱心網友回復:
假設您要使用的欄位number不是email您所要做的就是轉到LoginController以下路徑中app/Http/Controllers/Auth/LoginController.php
并添加以下方法:
public function username()
{
return 'number';
}
順便說一句,該欄位必須是一個字串。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/441444.html
