Paginator
in package
Table of Contents
Properties
- $currentPage : int
- $pageSize : int
- $paginatedItems : Collection
- $routeBasename : string
- Optionally provide a route basename to be used in generating the pagination links.
Methods
- __construct() : mixed
- canNavigateBack() : bool
- Determine if there are fewer items after the cursor in the data store.
- canNavigateForward() : bool
- Determine if there are more items after the cursor in the data store.
- currentPage() : int
- Get the current page number (which is used as a cursor).
- firstItemNumberOnPage() : int
- getItemsForPage() : Collection
- getPageLinks() : array<string|int, mixed>
- getPaginatedItems() : Collection
- Get the paginated collection
- hasMultiplePages() : bool
- Determine if there are enough items to split into multiple pages.
- lastPage() : int
- Get the page number of the last available page.
- next() : false|string|Route
- nextPageNumber() : false|int
- perPage() : int
- The number of items to be shown per page.
- previous() : false|string|Route
- previousPageNumber() : false|int
- setCurrentPage() : Paginator
- Set the current page number.
- totalPages() : int
- Get the total number of pages.
- firstPage() : int
- formatLink() : string
- formatPageName() : string
- generate() : void
- getRoute() : Route|string
- validateCurrentPageValue() : void
Properties
$currentPage
protected
int
$currentPage
= 1
$pageSize
protected
int
$pageSize
= 25
$paginatedItems
protected
Collection
$paginatedItems
$routeBasename
Optionally provide a route basename to be used in generating the pagination links.
protected
string
$routeBasename
Methods
__construct()
public
__construct([Arrayable|array<string|int, mixed> $items = [] ][, int $pageSize = 25 ][, int $currentPageNumber = null ][, string $paginationRouteBasename = null ]) : mixed
Parameters
- $items : Arrayable|array<string|int, mixed> = []
- $pageSize : int = 25
- $currentPageNumber : int = null
- $paginationRouteBasename : string = null
canNavigateBack()
Determine if there are fewer items after the cursor in the data store.
public
canNavigateBack() : bool
Return values
boolcanNavigateForward()
Determine if there are more items after the cursor in the data store.
public
canNavigateForward() : bool
Return values
boolcurrentPage()
Get the current page number (which is used as a cursor).
public
currentPage() : int
Return values
intfirstItemNumberOnPage()
public
firstItemNumberOnPage() : int
Return values
intgetItemsForPage()
public
getItemsForPage() : Collection
Return values
CollectiongetPageLinks()
public
getPageLinks() : array<string|int, mixed>
Return values
array<string|int, mixed>getPaginatedItems()
Get the paginated collection
public
getPaginatedItems() : Collection
Return values
CollectionhasMultiplePages()
Determine if there are enough items to split into multiple pages.
public
hasMultiplePages() : bool
Return values
boollastPage()
Get the page number of the last available page.
public
lastPage() : int
Return values
intnext()
public
next() : false|string|Route
Return values
false|string|RoutenextPageNumber()
public
nextPageNumber() : false|int
Return values
false|intperPage()
The number of items to be shown per page.
public
perPage() : int
Return values
intprevious()
public
previous() : false|string|Route
Return values
false|string|RoutepreviousPageNumber()
public
previousPageNumber() : false|int
Return values
false|intsetCurrentPage()
Set the current page number.
public
setCurrentPage(int $currentPage) : Paginator
Parameters
- $currentPage : int
Return values
PaginatortotalPages()
Get the total number of pages.
public
totalPages() : int
Return values
intfirstPage()
protected
firstPage() : int
Return values
intformatLink()
protected
formatLink(int $offset) : string
Parameters
- $offset : int
Return values
stringformatPageName()
protected
formatPageName(int $offset) : string
Parameters
- $offset : int
Return values
stringgenerate()
protected
generate(Collection $items) : void
Parameters
- $items : Collection
getRoute()
protected
getRoute(int $offset) : Route|string
Parameters
- $offset : int
Return values
Route|stringvalidateCurrentPageValue()
protected
validateCurrentPageValue(int $currentPage) : void
Parameters
- $currentPage : int