Skip to content

[9.x] Expose next and previous cursor of cursor paginator#41001

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
gdebrauwer:cursorpagination_prev_and_next_page
Feb 15, 2022
Merged

[9.x] Expose next and previous cursor of cursor paginator#41001
taylorotwell merged 3 commits into
laravel:9.xfrom
gdebrauwer:cursorpagination_prev_and_next_page

Conversation

@gdebrauwer

@gdebrauwer gdebrauwer commented Feb 14, 2022

Copy link
Copy Markdown
Contributor

The json response of a CursorPaginator does currently not expose the raw values of the next cursor and previous cursor (it only exposes full URLs), while that is something that should be exposed by default in my opinion. This is similar to the LengthAwarePaginator, where the values of the current / next / last page are also exposed.

@gdebrauwer gdebrauwer changed the title [9.x] Expose next/previous cursors of cursor paginator [9.x] Expose next and previous cursor of cursor paginator Feb 14, 2022
@taylorotwell

Copy link
Copy Markdown
Member

Think it makes sense to serialize them as next_cursor and prev_cursor instead?

@gdebrauwer

Copy link
Copy Markdown
Contributor Author

I chose to use _page suffix because of the existing next_page_url / prev_page_url fields, but you are probably right that it is better if we use the _cursor suffix for these new fields 👍

@taylorotwell
taylorotwell merged commit 8e15796 into laravel:9.x Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants