Hi,
I have a many to many relation defined like this:
public function facilities()
{
return $this->belongsToMany(
UnitFacilityType::class,
'unit_facilities',
'unit_id',
'unit_facility_type_id'
);
}
and inside the controller I make something like this:
$items = $unitBuilder->whereHas('facilities', function (Builder $query) {
$query->whereIn('unit_facility_types.id', [63, 64]);
})->get();
dd($items[3]);
$items returns me records either with id 63 or with id 64 and I want it to return only records that have both id 63 and id 64.
What is wrong?
Thanks!