Simple generate paginate custom Laravel, with any array. When not possible use standard pagination of eloquent methods use this package.
Installation by composer require
composer require firmino/easy-paginator
Installation manually, add in file composer.json
{
"require": {
"firmino/easy-paginator": "1.0.9"
}
}
Laravel's package discovery will take care of integration for you.
Add the following settings to your app.php file.
'providers' => array(
//...
Firmino\EasyPaginator\Providers\EasyPaginatorServiceProvider::class,
),
and add aliases
'EasyPaginator' => Firmino\EasyPaginator\Facades\EasyPaginator::class
Import Facade
use EasyPaginator;
// Array $items - data to generation paginate
// int $itemsCount - length array data
// int $perPage - amount of items per page
// int $currentPage - page current to show data
EasyPaginator::paginate($items, $itemsCount, $perPage, $currentPage);