nulltex / laravel-paginator
Laravel most flexible paginator
Requires
- php: ^7.4
- illuminate/contracts: ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ^1.3
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^8.0 || ^9.0
This package is auto-updated.
Last update: 2024-06-20 11:33:09 UTC
README
Some small helper for customize paginator links.
Allows to pass route name to paginator for generate custom URLs.
Installation
You can install the package via composer:
composer require nulltex/laravel-paginator
Usage
You can use setRoute()
method for set custom route name that will be used for generate pagination links.
Example:
$query = Model::query(); $paginator = $query->paginate()->setRoute(['route.name'])
By default paginator generates relative URL.
If you want to use absolute ones just call setRouteAbsoluteUrl()
$paginator->setRouteAbsoluteUrl(true)
Note: $pageName
(default values is page
) will be automatically applied to the route params.
If you want to change it just use setPageName()
.
For send some additional params into Route (excepting $pageName
) pass them as array in the second item:
$query = Model::query(); $paginator = $query->paginate()->setRoute(['route.name', ['param' => 'value']])
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.