Pagination
Pagination is a crucial feature in web applications, enabling you to divide large datasets into smaller, more manageable chunks. Maginium offers a powerful and flexible pagination system that integrates seamlessly with the framework's data querying capabilities.
Getting Started
Pagination in Maginium is implemented using the built-in paginator. The paginator can be used with database queries, collections, or any iterable dataset to provide efficient navigation across multiple pages.
Important: Maginium's paginator is optimised for both performance and user experience, offering intuitive methods for customization.
Using Pagination with Query Builder
The query builder's paginate
method simplifies database pagination:
This generates a paginated result set containing 10 records per page.
Accessing Pagination Data
Once you have a paginated result set, you can access additional pagination data:
Pagination Links
The links
method generates HTML for pagination controls:
Customizing Pagination
Maginium's paginator allows customization of the number of items per page and query parameters:
Advanced Customization
You can modify the pagination view to meet your application's needs:
Pagination with Collections
If you're working with collections, you can use the forPage
method:
API Pagination
For API responses, Maginium provides JSON structures that include pagination metadata:
The response includes:
Data: Current page's dataset
Meta: Pagination information (e.g., total items, current page, last page)
Example Response
Last updated