【发布时间】:2019-07-07 12:45:52
【问题描述】:
我有如下three table 关系
国家 ->(有很多)省 ->(有很多)城市
我想知道 Eloquent 中是否有任何方法可以获取所有第二个孩子的国家,即城市有 status=active
我知道通过 Eloquent 提供的 hasManyThrough 关系助手可以找到单个县的活跃城市。但我需要检索all Countries who even has a single active city。
注意:我不想遍历每个国家/地区。
【问题讨论】: