API Documentation

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

$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
bool

canNavigateForward()

Determine if there are more items after the cursor in the data store.

public canNavigateForward() : bool
Return values
bool

currentPage()

Get the current page number (which is used as a cursor).

public currentPage() : int
Return values
int

firstItemNumberOnPage()

public firstItemNumberOnPage() : int
Return values
int

getItemsForPage()

public getItemsForPage() : Collection
Return values
Collection
public getPageLinks() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPaginatedItems()

Get the paginated collection

public getPaginatedItems() : Collection
Return values
Collection

hasMultiplePages()

Determine if there are enough items to split into multiple pages.

public hasMultiplePages() : bool
Return values
bool

lastPage()

Get the page number of the last available page.

public lastPage() : int
Return values
int

nextPageNumber()

public nextPageNumber() : false|int
Return values
false|int

perPage()

The number of items to be shown per page.

public perPage() : int
Return values
int

previousPageNumber()

public previousPageNumber() : false|int
Return values
false|int

setCurrentPage()

Set the current page number.

public setCurrentPage(int $currentPage) : Paginator
Parameters
$currentPage : int
Return values
Paginator

totalPages()

Get the total number of pages.

public totalPages() : int
Return values
int

firstPage()

protected firstPage() : int
Return values
int
protected formatLink(int $offset) : string
Parameters
$offset : int
Return values
string

formatPageName()

protected formatPageName(int $offset) : string
Parameters
$offset : int
Return values
string

generate()

protected generate(Collection $items) : void
Parameters
$items : Collection

getRoute()

protected getRoute(int $offset) : Route|string
Parameters
$offset : int
Return values
Route|string

validateCurrentPageValue()

protected validateCurrentPageValue(int $currentPage) : void
Parameters
$currentPage : int

        
On this page

Search results