michaeljennings / eloquent-paginator
Adds a new paginate method to laravel eloquent that retains select statements
Installs: 162
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/michaeljennings/eloquent-paginator
Requires
- illuminate/database: ^5.1
- illuminate/pagination: ^5.1
Requires (Dev)
- orchestra/testbench: ^3.6
This package is auto-updated.
Last update: 2025-10-06 11:57:20 UTC
README
Eloquent is awesome, but occasionally I hit into an issue with paginating with having clauses.
This package adds a new method to the eloquent builder that retains the select statements while paginating.
Installation
Install through composer using composer require michaeljennings/eloquent-paginator or add the package to the require section of your composer.json file.
"require": {
...
"michaeljennings/eloquent-paginator": "^1.0"
}
Then run composer update to install the package.
Usage
Instead of using paginate use paginateWithSelects instead.
$query->paginate(15); $query->paginateWithSelects(15);
As the we retain the select queries from the query you cannot specify the columns like you can with the standard paginate method.
However you can still specify the paginator name and the currency page if needed.
$query->paginateWithSelects(15, 'foo', 2);