Created
December 8, 2018 17:12
-
-
Save salipro4ever/e77d373325bef9ddd528bf55bd3ed360 to your computer and use it in GitHub Desktop.
You can add this method as Collection method in AppServiceProvider. just add this in boot method.
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
if (!Collection::hasMacro('AppServiceProvider')) { | |
Collection::macro('paginate', | |
function ($perPage = 15, $page = null, $options = []) { | |
$page = $page ?: (Paginator::resolveCurrentPage() ?: 1); | |
return (new LengthAwarePaginator( | |
$this->forPage($page, $perPage), $this->count(), $perPage, $page, $options)) | |
->withPath(''); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment