我试图从更改默认的主键id的users表userId,但Laravel认证机制始终检查id从users表.例:
Users :: check()和Users :: attempt()
这些函数总是检查表的id属性users,如何改变Laravel的这种行为.
小智 5
要覆盖用于搜索的主键,必须在User模型上定义primaryKey属性.
protected $primaryKey = 'userId';
Run Code Online (Sandbox Code Playgroud)