I am doing an API using Laravel's Passport, and whenever I send a request to one of my resources, I get this error:
{
"message": "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'where clause' (SQL: select * from `users` where `id` = 1 limit 1)",
"exception": "Illuminate\\Database\\QueryException",
...
}
We can see that it doesn't find the id
column, that's because I renamed it to USER_ID
.
I have seen this answer, but I don't see how I could use it in my case.
I tried this in my User.php
model:
public function findForPassport($username) {
return $this->where('USER_ID', $username)->first();
}
But it didn't fix the problem.
Thank you for your help.