Dibyaranjan Dibyaranjan - 5 months ago 41
PHP Question

Laravel change id column to userId in users table

i am trying to change the id of users table to userId, but laravel authentication mechanism always checks for id column of users table.like

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';