I have 3 database tables (users, marketplaces, orders). One user can have many marketplaces and one marketplace has a morphMany relationship with orders. My user model: `
public function marketplaces(): BelongsToMany
{
return $this->belongsToMany(Marketplace::class);
}
Marketplace model:
public function orders()
{
return $this->morphMany(Order::class, 'orderable');
}
`
I need to retrive the orders which is ordered by a spacific user through his many marketplaces. How can I do that with the help or eloquent in laravel?