@fcno can you show an example how your url looks like (simple id/slug or record?)
Also - does you index page contains some filters and you want to apply all of this filters to next/prev too? like sorting order, and maybe filtering by some params
I have an index page with thousands of records (let's use the 'cars' model as an example). They are being displayed paginated.
On this index page, there is a link to the show page where the car is displayed in more detail.
On the show page there is a next and previous button to allow the user to navigate between the records without having to go back to the index.
However, calculating the next and previous requires unnecessary 'complexity' that could be circumvented using laravel's default pagination. Something like 'paginate(1)'.
The problem: how would I be able to set the exact pagination page (on the show page) based on the (car) link clicked by the user on the index page? That is, I have the car object and how do I find the next and the previous one using Laravel's default pagination strategy?
Thx for your help.
Also when going to that page you can calculate where it would be if paginate is 1. A simple count up to that record will give you the placement.
Then of course let this be a separate query.
Please or to participate in this conversation.