This is my query:
$items = UserItems::with('item')
->where('user_id','=',$this->id)
->where('quantity','>',0)
->where('items.type','=',"shirt")
->get();
I need all items where type
is shirt
.
The query returns this:
Column not found: 1054 Unknown column 'items.type' in 'where clause'
For some reasons, the items
is not recognized as a table in this query, and I can't use `where on it.
Then how I can get all user items where the item type is shirt
?