jaspercreel started a new conversation+100 XP
5mos ago
Hi all,
Eager loading a many-to-many relationship with a "wherePivot" clause is making it empty, even though there is data. I can do this:
$thing->relations;
and there is data. But if I do this:
$thing->load('relations');
it is empty.
The relationship looks like this:
public function relations()
{
return $this->belongsToMany(Relation::class)->withPivot('other_id', $this->other_id);
}
What could be causing this? Anyone else encounter this?