Routing and Pagination

I’m working on a new side project (because that’s how you spend your weekends ) and I’m coding a simple api that I’ll use to fetch images that I’ll later display on my home.

My question is, is there a way to fetch a particular “page number” or “pagination block”?
My route is like this api/images/(:num?) and I fetch 10 images at the time. What I’m trying to code is a route where this api/images/3 gives me the same result as this api/images/page:3

Appreciate the help.

You can manually set the pagination page like this:

$paginated = $collection->paginate(10, ['page' => 3]);
1 Like

Awesome.
Didn’t know about this one. Thanks