This is a simple implementation of the Laravel pagination using InertiaJS without having to create a custom LengthAwarePaginator class.
I've built it to match my needs, therefore you can find it limited to your purpose, so fill free to modify it as it suits your! :)
@carnou
Mauro Baptista
- Copy and paste the component Pagination into your project.
- Where you have a paginate result, import the Pagination component into it, and then add the following props:
Item | Is required? | Type | Description |
---|---|---|---|
current-page | yes | Number | |
last-page | yes | Number | |
path | yes | String | Base path for the pagination link |
query | no | Object | Items to be added in the query |
<Pagination
:current-page="posts.current_page"
:last-page="posts.last_page"
:path="posts.path"
:query="{test: 'hi', another: 'test'}"
/>
Output: http://localhost:3000/dashboard/posts?test=hi&another=test&page=7