nulltex/laravel-paginator

Laravel most flexible paginator

1.0.0 2020-10-20 02:30 UTC

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.

Latest Version on Packagist Check & fix styling Total Downloads

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.