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 authored and eronisko committed Apr 25, 2024
1 parent eb5bafe commit 6575b13
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 6575b13

Please sign in to comment.