Laravel Eloquent limit results for relationship
问题 I have a simple set-up of Albums and Images, each album has many images. I can get all the data fine but I want to limit the returned number of images to 3. I have tried passing a closure like so: Album::with(['images' => function($query) { $query->take(3);}])->get(); This does limit the number of images to 3 but it limits the total count of images to 3 but I want to limit each album to 3 images. So the first album will show 3 images as expected but all the other albums have no images. I have