Skip to content

[12.x] create a Pagination component #56295

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

Open
wants to merge 5 commits into
base: 12.x
Choose a base branch
from

Conversation

browner12
Copy link
Contributor

This component generates the same output as ->links(), but provides the more familiar component pattern for declaring it. I believe this is better because:

  • it allows consistent usage of components throughout user's codebase
  • opens up the opportunity for the framework to easily provide more controlled customization of the output of the pagination. for example, you could pass an attribute to disable the "Showing X to X of X results".

Previously:

{{ $blogs->links() }}

New:

<x-laravel::pagination :paginator="$blogs"></x-laravel::pagination>

Users still have the ability to pass their own custom view and data to the component:

<x-laravel::pagination
    :paginator="$blogs"
    view="/my/custom/view"
    :data="['foo', 'bar', 'baz']"
></x-laravel::pagination>

I have not added any additional customization in this PR, but opted to wait to see if this would be accepted.

this component generates the same output as `->links()`, but provides the more familiar component pattern for declaring it.
the "prefix" parameter didn't do what I thought it did
this allows the user to continue using the *logic* of the Paginator and Component, but fully customize the styling with their own view.
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.

1 participant