0
votes
  1. I am using user_sk as primary key in users table
  2. When authenticate with passport its not overriding primary key from model
  3. Already palced User model have protected $primaryKey = 'user_sk';

Its always shows error like this

"message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'where clause' (SQL: select * from `users` where `id` = 32 limit 1)"
1

1 Answers

0
votes

It seems it is probably a relation that is breaking your code, based on the following question, this can not be marked as duplicate since the question has not accepted the answer.

Add the following to your User.php model and see if it helps.

public function clients() {
    return $this->hasMany(Passport::clientModel(), 'user_id', 'user_sk');
}