amrnn90 / laravel-cursor-paginator

Cursor pagination for Laravel
MIT License
18 stars 6 forks source link

Ability to return previous URL even when currently no previous items #11

Closed trevorgehman closed 4 years ago

trevorgehman commented 4 years ago

So right now I'm using this package to return a collection of inbox threads sorted by created_at,id. On the first page of results, the $meta['previous'] value is null, because it's the first page.

The issue is that let's say some time has passed and I receive a notification that new threads are available. I'd like to simply pull in new threads, which means I'd need to know the value for the previous_page cursor.

So I'm wondering whether we could have the ability to return the previous_page cursor even when on the first page, and rely on a boolean has_previous or something to know whether to use it?

amrnn90 commented 4 years ago

Sorry for the late response @trevorgehman Added what you asked for in v2.0.0