Laravel身份验证-不同表中的电子邮件 [英] Laravel Authentication - Email in different table
本文介绍了Laravel身份验证-不同表中的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个表:
人:
id name email phone person_type_id
用户
id person_id password role_id etc...
能否请您告诉我,在验证用户身份时,如何使内置于身份验证系统中的Laravel(5.8)使用 persons 表中的 email 字段?仅供参考,警卫提供者的价值必须是用户.
Could you please tell me how to make Laravel's (5.8) built in Authentication System use the email field from persons table when authenticating a user? FYI, the value of guard provider has to be users.
推荐答案
您可以创建自定义用户提供程序(继承自Illuminate\Auth\EloquentUserProvider
)并覆盖retrieveByCredentials
方法.
You could create a custom user provider (which inherits from Illuminate\Auth\EloquentUserProvider
) and override the retrieveByCredentials
method.
这篇关于Laravel身份验证-不同表中的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文