我有一对多的关系在雄辩的宣称。
我了解如何为某一集检索serial数据:
TheEpisode::where('id', '=', $id)->take(1)->with('TheParts', 'TheAuthor')但我是怎么做的,还能找回电视剧的情节吗?
`Table: TheSeries`
id | SerialName
---------------------
1 | Zootopia
2 | Moana
3 | Toy Story
`Table: TheEpisodes`
seriesID| episode
---------------------
1 | 10
2 | 10
3 | 10
1 | 11
2 | 11
2 | 12我需要所有的莫阿纳电视连续剧(应该是:10,11,12集)
我该如何查询呢?
发布于 2016-12-25 20:22:54
用急装获得所有的连续剧
Serial::where('id', $serialId)->with('episodes')->first();得到所有的情节:
TheEpisode::where('serial_id', $serialId)->get();https://stackoverflow.com/questions/41324217
复制相似问题