Download the PHP package flagstudio/laravel-paginate without Composer
On this page you can find all versions of the php package flagstudio/laravel-paginate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download flagstudio/laravel-paginate
More information about flagstudio/laravel-paginate
Files in flagstudio/laravel-paginate
Package laravel-paginate
Short Description Different paginate macros for laravel eloquent builder and collection
License MIT
Informations about the package laravel-paginate
Set of Laravel Builder and Collection macros for pagination
Installation
You can pull in the package via composer:
The package will automatically register itself.
Macros
These macros are used for Eloquent Builder and Collection. The main difference in using pagination on a collection or builder is that builder has not yet perform the database request, i.e. paginate will perform request to get needed amount of records from database. Collection already have all elements and paginate will not perform any database requests.
paginate
paginateFirstDifferent
paginateWithPrevious
paginate
Create a LengthAwarePaginator
instance from Builder or Collection.
This paginates the contents of $posts
with 5 items per page. paginate
accept some options, head over to the Laravel docs for an in-depth guide.
paginateFirstDifferent
Create a FirstDifferentLengthAwarePaginator.php
instance which extend LengthAwarePaginator
from Builder or Collection.
This paginates the contents of $posts
with 10 items at first page and 5 items for next pages. paginateFirstDifferent
accepts same options as paginate
but instead of $perPage
accepts two parameters $firstPerPage
and $nextPerPage
You can also pass third parameter to get all post from first to current page.
paginateWithPrevious
Create a LengthAwarePaginator
instance from Builder or Collection.
This paginates the contents of $posts
with 5 items per page but takes all posts from first to current page. At example if current page equals 5 then paginateWithPrevious
will return 25 posts (5 per each page). It useful if you want load all posts for current page after reloading page or share link with pagination (https://website.com/posts?page=5). paginateWithPrevious
accepts same options as paginate