我的 laravel 项目中有经理表和资金表
经理 -> id、姓名、钱包资金 -> id、金额、fundable_type、fundable_id、应收款类型、应收款ID、状态
我在 Manager 模型中有以下关系
public function funds()
{
return $this->morphMany(Fund::class, 'fundable');
}
public function receiveds()
{
return $this->morphMany(Fund::class, 'receivable');
}
我在基金模型中有以下关系
public function fundable()
{
return $this->morphTo();
}
public function receivable()
{
return $this->morphTo();
}
$manager->funds 很好地填充了基金模型。
我想接收收到资金的经理特定经理。
我试过 $manager->funds->receivable 但它不起作用。