Let's say I got an array: [2,3,4]
(array length / amount of values in array changes so I cannot hardcode it with bunch of where's)
And I want to get only the items which include all of the values in array while querying a relationship.
I am aware of WhereIn and using it like so:
->whereHas('interests', function($query) use ($arrayIds) {
$query->whereIn('interest_id', $arrayIds);
})
But this is basically
orWhere()->orWhere->get();
How can I achieve behaviour of:
->where()->where()->get();
So that all values in array would have to match instead while using an array of id's?
the items which include all of the values in arraywhat do you mean exactly?