优化 CategoriesController 中使用查询
Categories N+1优化
- 修改app/Http/Controllers/CategoriesController.php
- $topics = Topic::where('category_id', $category->id)->with('category', 'user')->paginate(20);
- 避免N +1 问题
推荐文章: