0
雄辩的ORM hasManyThrough允许我达到1个区域的对象。 有没有一种简单的方法来获取比超过1段的对象?雄辩的ORM hasManyThrough超过1段
比如我有这样的对象:
account survey - account_id respondent - survey_id content - respondent_id
我将如何能够获取给定帐户对象的内容对象?
雄辩的ORM hasManyThrough允许我达到1个区域的对象。 有没有一种简单的方法来获取比超过1段的对象?雄辩的ORM hasManyThrough超过1段
比如我有这样的对象:
account survey - account_id respondent - survey_id content - respondent_id
我将如何能够获取给定帐户对象的内容对象?
我不知道有什么方法可以使用hasManyThrough()
访问2段,但如果你建立了所有的关系,你可以加载它们。
$accounts = Account::with('surveys.respondents.content')->get();
没有内建的方法。 – 2014-09-06 15:22:23