我加入 ?include=topic.user 出现 N+1 ,是我哪里出现问题呢?
?include=topic 时, sql 没有 N+1
?include=topic.user 时,出现大量 users表查询
所有 Model 对照 github 源码





关于 LearnKu
@getelephant @Kevinvinvin @ejellyfish @JunLee @maxotm @swfszf @BboyFate
https://github.com/dingo/api/blob/v2.0.0/s...
问题找到了,不是 laravel 的问题,dingo 升级到 2.0 之后加入了上面的代码,要求必须是 AvailableIncludes 中设置过的才能预加载。
这导致只预加载了 topic,应该是个 bug,如果是线上的环境可以先切换回 2.0.0 以下的版本。等待一下新的 pr,我研究一下