I am trying to change the default primary key from id
of users
table to userId
, but Laravel authentication mechanism always checks for id
from users
table. Example:
Users::check() and Users::attempt()
These functions always check for id
attribute of users
table, how to change this behavior of Laravel.
To override the primary key used to search you must define the primaryKey property on the User model.
protected $primaryKey = 'userId';
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments