So Basically i have the model foo:
protected $with = ['bars'];
public function bars()
{
return $this->morphMany(bar::class, 'barable');
}
And the model bar:
public function barable()
{
return $this->morphTo();
}
Now my question is, if i want to load foo via bar:
Bar::find(1)->with(['barable.something.this'])->get();
I get the foo table alongside with the corresponding bar.
Now because the bars attribute of foo has many entries (including the original bar which i request the foo through) i want to exclude the barable.bars, but since its included in the with attribute, it's always loaded.
How can i exclude barable.bars from my query?
edit: I'm using laravel 5.6 if that matters