Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

gdebrauwer
Copy link
Contributor

@gdebrauwer gdebrauwer commented Feb 14, 2022

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
Member

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

@gdebrauwer
Copy link
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.

None yet

2 participants