I have a project where I have changed the User model primary key from \"id\" to \"MemberX\" using the following command in my User.php model file:
protected $primaryKey
Add this code to your User model
{
return $this->hasMany(Passport::clientModel(), 'user_id', 'MemberID');
}
Maybe you should check if the driver on the laravel/config/auth.php has eloquent
instead of database
?
'providers' => [
'users' => [
'driver' => 'eloquent', //instead of database
'model' => App\User::class,
],
database
uses DatabaseUserProvider
which the find
method only looks on the id
column.
eloquent
uses EloquentUserProvider
which the find
method looks at the primary key if $primaryKey is defined before looking at id
.