I have mangers table and funds table in my laravel project
Managers -> id, name, wallet Funds -> id, amount, fundable_type, fundable_id, receivable_type, receivable_id, status
I have the following relations in Manager model
public function funds()
{
return $this->morphMany(Fund::class, 'fundable');
}
public function receiveds()
{
return $this->morphMany(Fund::class, 'receivable');
}
I have the following relations in Fund model
public function fundable()
{
return $this->morphTo();
}
public function receivable()
{
return $this->morphTo();
}
$manager->funds is populating fund models well.
I want to receive the managers who received fund a particular manager.
I tried $manager->funds->receivable but it is not working.
In relations specifications you can append the other model's relations: