查询Laravel多态关系的标准和专业方法是什么?

问题描述

尝试根据多态关系的结果获取人员表。这样做的专业标准方法是什么?非常感谢!

可插入模型

public function insertables() {
return $this->morphMany(Insertable::class,'insertable');
}

人物模型

public function insertable () {
return $this->morphTo();    
}

$people = Person::find($id)->insertables;
$peopleIds = $people->pluck('person_id');
return response()->json(Person::whereIn('id',$peopleIds)->get());

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)