Eloquent ORM hasManyThrough允许我到达1个分段的物体。 是否有一种简单的方法来获取对象而不是超过1段?
例如我有这样的对象:
account survey - account_id respondent - survey_id content - respondent_id
我如何获取给定帐户对象的内容对象?
答案 0 :(得分:1)
我不知道有什么方法可以使用hasManyThrough()
访问2个细分受众群,但如果您已经建立了所有关系,就可以急切加载它们。
$accounts = Account::with('surveys.respondents.content')->get();