Skip to content

Commit

Permalink
[collection] index size parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
rastislav-chynoransky committed Apr 24, 2024
1 parent 0367689 commit 27ad7ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Http/Controllers/Api/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 27ad7ee

Please sign in to comment.