From 6575b138e0c50dd517eb93070e95777e4431c391 Mon Sep 17 00:00:00 2001 From: Rastislav Chynoransky Date: Wed, 24 Apr 2024 16:13:14 +0200 Subject: [PATCH] [collection] index size parameter --- app/Http/Controllers/Api/CollectionController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/CollectionController.php b/app/Http/Controllers/Api/CollectionController.php index 4123e091c..e351bf626 100644 --- a/app/Http/Controllers/Api/CollectionController.php +++ b/app/Http/Controllers/Api/CollectionController.php @@ -10,11 +10,12 @@ class CollectionController extends Controller { public function index() { + $size = request()->integer('size', 1); $paginator = Collection::query() ->published() ->when(request()->boolean('featured'), fn($query) => $query->where('featured', true)) ->orderBy('published_at', 'desc') - ->paginate(); + ->paginate($size); return CollectionResource::collection($paginator); }