I have Account model that has id, name, timestamps and other fields, I have AccountUser model with account_id and user_id fields, and I have User model with users ids.
I'm trying to get users by account (account has many users) using $this->hasManyThrough('App\User', 'App\AccountUser')->get(); but I have an error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users.account_user_id' in 'on clause' (SQL: select users
.*, account_users
.account_id
from users
inner join account_users
on account_users
.id
= users
.account_user_id
where account_users
.account_id
= 1).
I don't need 'users.account_user_id' column, but it is in query, what to do? Thank you.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire