Closed panthro100 closed 1 year ago
Hi @panthro100, Use this relationship:
class Producer extends Model
{
use \Staudenmeir\EloquentHasManyDeep\HasRelationships;
public function whiskies()
{
return $this->hasManyDeep(Whisky::class, [Distillery::class, 'distillery_whisky']);
}
}
A
Producer
hasOne
Distillery
, aDistillery
belongsToMany
Whiskies
.A
Whisky
belongsToMany
Distillery
, aDistillery
belongsTo
Producer
.I wish to use
hasManyThrough
so, to get aProducer
'sWhiskies
thatbelongToMany
Distillery
.But how can I use
hasManyThrough
withbelongsToMany
relationship? I am aware you can specify the join keys, and I think you may be able to muck about with the pivot table, but I can't figure it out.Will this package help?