Laravel orm – Get top rows from relation
I have a categories table. every category has some posts. I want to get categories with their last 10 posts. So I tried this: Category::query()->with(['posts' => function($q) { $q->take(10); }])->get(); The problem is instead of putting 10 posts in each…