Created
April 4, 2017 19:10
-
-
Save jleonardolemos/3d3775ba0cd7cd8462689b47623b04ac to your computer and use it in GitHub Desktop.
collection_paginator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function getPaginator($products){ | |
$page = LengthAwarePaginator::resolveCurrentPage('page'); | |
$perPage = 5; | |
return new LengthAwarePaginator( | |
$products->slice(($page - 1) * $perPage)->take($perPage), | |
$products->count(), | |
$perPage, | |
$page, | |
[ | |
'path' => LengthAwarePaginator::resolveCurrentPath(), | |
'pageName' => 'page', | |
] | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment