AbstractPaginator
in package
implements
Htmlable
Tags
Interfaces, Classes and Traits
Table of Contents
- $defaultSimpleView : string
- The default "simple" pagination view.
- $defaultView : string
- The default pagination view.
- $currentPage : int
- The current page being "viewed".
- $currentPageResolver : Closure
- The current page resolver callback.
- $currentPathResolver : Closure
- The current path resolver callback.
- $fragment : string|null
- The URL fragment to add to all URLs.
- $items : Collection
- All of the items being paginated.
- $pageName : string
- The query string variable used to store the page.
- $path : string
- The base path to assign to all URLs.
- $perPage : int
- The number of items to be shown per page.
- $query : array<string|int, mixed>
- The query parameters to add to all URLs.
- $viewFactoryResolver : Closure
- The view factory resolver callback.
- __call() : mixed
- Make dynamic calls into the collection.
- __toString() : string
- Render the contents of the paginator when casting to string.
- appends() : $this
- Add a set of query string values to the paginator.
- count() : int
- Get the number of items for the current page.
- currentPage() : int
- Get the current page.
- currentPageResolver() : void
- Set the current page resolver callback.
- currentPathResolver() : void
- Set the current request path resolver callback.
- defaultSimpleView() : void
- Set the default "simple" pagination view.
- defaultView() : void
- Set the default pagination view.
- firstItem() : int
- Get the number of the first item in the slice.
- fragment() : $this|string|null
- Get / set the URL fragment to be appended to URLs.
- getCollection() : Collection
- Get the paginator's underlying collection.
- getIterator() : ArrayIterator
- Get an iterator for the items.
- getPageName() : string
- Get the query string variable used to store the page.
- getUrlRange() : array<string|int, mixed>
- Create a range of pagination URLs.
- hasPages() : bool
- Determine if there are enough items to split into multiple pages.
- isEmpty() : bool
- Determine if the list of items is empty or not.
- isNotEmpty() : bool
- Determine if the list of items is not empty.
- items() : array<string|int, mixed>
- Get the slice of items being paginated.
- lastItem() : int
- Get the number of the last item in the slice.
- offsetExists() : bool
- Determine if the given item exists.
- offsetGet() : mixed
- Get the item at the given offset.
- offsetSet() : void
- Set the item at the given offset.
- offsetUnset() : void
- Unset the item at the given key.
- onFirstPage() : bool
- Determine if the paginator is on the first page.
- perPage() : int
- Get the number of items shown per page.
- previousPageUrl() : string|null
- Get the URL for the previous page.
- resolveCurrentPage() : int
- Resolve the current page or return the default value.
- resolveCurrentPath() : string
- Resolve the current request path or return the default value.
- setCollection() : $this
- Set the paginator's underlying collection.
- setPageName() : $this
- Set the query string variable used to store the page.
- setPath() : $this
- Set the base path to assign to all URLs.
- toHtml() : string
- Render the contents of the paginator to HTML.
- url() : string
- Get the URL for a given page number.
- viewFactory() : Factory
- Get an instance of the view factory from the resolver.
- viewFactoryResolver() : void
- Set the view factory resolver callback.
- withPath() : $this
- Set the base path to assign to all URLs.
- addQuery() : $this
- Add a query string value to the paginator.
- appendArray() : $this
- Add an array of query string values.
- buildFragment() : string
- Build the full fragment portion of a URL.
- isValidPageNumber() : bool
- Determine if the given value is a valid page number.
Properties
$defaultSimpleView
The default "simple" pagination view.
public
static string
$defaultSimpleView
= 'pagination::simple-default'
$defaultView
The default pagination view.
public
static string
$defaultView
= 'pagination::default'
$currentPage
The current page being "viewed".
protected
int
$currentPage
$currentPageResolver
The current page resolver callback.
protected
static Closure
$currentPageResolver
$currentPathResolver
The current path resolver callback.
protected
static Closure
$currentPathResolver
$fragment
The URL fragment to add to all URLs.
protected
string|null
$fragment
$items
All of the items being paginated.
protected
Collection
$items
$pageName
The query string variable used to store the page.
protected
string
$pageName
= 'page'
$path
The base path to assign to all URLs.
protected
string
$path
= '/'
$perPage
The number of items to be shown per page.
protected
int
$perPage
$query
The query parameters to add to all URLs.
protected
array<string|int, mixed>
$query
= []
$viewFactoryResolver
The view factory resolver callback.
protected
static Closure
$viewFactoryResolver
Methods
__call()
Make dynamic calls into the collection.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Return values
mixed —__toString()
Render the contents of the paginator when casting to string.
public
__toString() : string
Return values
string —appends()
Add a set of query string values to the paginator.
public
appends(array<string|int, mixed>|string $key[, string|null $value = null ]) : $this
Parameters
- $key : array<string|int, mixed>|string
- $value : string|null = null
Return values
$this —count()
Get the number of items for the current page.
public
count() : int
Return values
int —currentPage()
Get the current page.
public
currentPage() : int
Return values
int —currentPageResolver()
Set the current page resolver callback.
public
static currentPageResolver(Closure $resolver) : void
Parameters
- $resolver : Closure
Return values
void —currentPathResolver()
Set the current request path resolver callback.
public
static currentPathResolver(Closure $resolver) : void
Parameters
- $resolver : Closure
Return values
void —defaultSimpleView()
Set the default "simple" pagination view.
public
static defaultSimpleView(string $view) : void
Parameters
- $view : string
Return values
void —defaultView()
Set the default pagination view.
public
static defaultView(string $view) : void
Parameters
- $view : string
Return values
void —firstItem()
Get the number of the first item in the slice.
public
firstItem() : int
Return values
int —fragment()
Get / set the URL fragment to be appended to URLs.
public
fragment([string|null $fragment = null ]) : $this|string|null
Parameters
- $fragment : string|null = null
Return values
$this|string|null —getCollection()
Get the paginator's underlying collection.
public
getCollection() : Collection
Return values
Collection —getIterator()
Get an iterator for the items.
public
getIterator() : ArrayIterator
Return values
ArrayIterator —getPageName()
Get the query string variable used to store the page.
public
getPageName() : string
Return values
string —getUrlRange()
Create a range of pagination URLs.
public
getUrlRange(int $start, int $end) : array<string|int, mixed>
Parameters
- $start : int
- $end : int
Return values
array<string|int, mixed> —hasPages()
Determine if there are enough items to split into multiple pages.
public
hasPages() : bool
Return values
bool —isEmpty()
Determine if the list of items is empty or not.
public
isEmpty() : bool
Return values
bool —isNotEmpty()
Determine if the list of items is not empty.
public
isNotEmpty() : bool
Return values
bool —items()
Get the slice of items being paginated.
public
items() : array<string|int, mixed>
Return values
array<string|int, mixed> —lastItem()
Get the number of the last item in the slice.
public
lastItem() : int
Return values
int —offsetExists()
Determine if the given item exists.
public
offsetExists(mixed $key) : bool
Parameters
- $key : mixed
Return values
bool —offsetGet()
Get the item at the given offset.
public
offsetGet(mixed $key) : mixed
Parameters
- $key : mixed
Return values
mixed —offsetSet()
Set the item at the given offset.
public
offsetSet(mixed $key, mixed $value) : void
Parameters
- $key : mixed
- $value : mixed
Return values
void —offsetUnset()
Unset the item at the given key.
public
offsetUnset(mixed $key) : void
Parameters
- $key : mixed
Return values
void —onFirstPage()
Determine if the paginator is on the first page.
public
onFirstPage() : bool
Return values
bool —perPage()
Get the number of items shown per page.
public
perPage() : int
Return values
int —previousPageUrl()
Get the URL for the previous page.
public
previousPageUrl() : string|null
Return values
string|null —resolveCurrentPage()
Resolve the current page or return the default value.
public
static resolveCurrentPage([string $pageName = 'page' ][, int $default = 1 ]) : int
Parameters
- $pageName : string = 'page'
- $default : int = 1
Return values
int —resolveCurrentPath()
Resolve the current request path or return the default value.
public
static resolveCurrentPath([string $default = '/' ]) : string
Parameters
- $default : string = '/'
Return values
string —setCollection()
Set the paginator's underlying collection.
public
setCollection(Collection $collection) : $this
Parameters
- $collection : Collection
Return values
$this —setPageName()
Set the query string variable used to store the page.
public
setPageName(string $name) : $this
Parameters
- $name : string
Return values
$this —setPath()
Set the base path to assign to all URLs.
public
setPath(string $path) : $this
Parameters
- $path : string
Return values
$this —toHtml()
Render the contents of the paginator to HTML.
public
toHtml() : string
Return values
string —url()
Get the URL for a given page number.
public
url(int $page) : string
Parameters
- $page : int
Return values
string —viewFactory()
Get an instance of the view factory from the resolver.
public
static viewFactory() : Factory
Return values
Factory —viewFactoryResolver()
Set the view factory resolver callback.
public
static viewFactoryResolver(Closure $resolver) : void
Parameters
- $resolver : Closure
Return values
void —withPath()
Set the base path to assign to all URLs.
public
withPath(string $path) : $this
Parameters
- $path : string
Return values
$this —addQuery()
Add a query string value to the paginator.
protected
addQuery(string $key, string $value) : $this
Parameters
- $key : string
- $value : string
Return values
$this —appendArray()
Add an array of query string values.
protected
appendArray(array<string|int, mixed> $keys) : $this
Parameters
- $keys : array<string|int, mixed>
Return values
$this —buildFragment()
Build the full fragment portion of a URL.
protected
buildFragment() : string
Return values
string —isValidPageNumber()
Determine if the given value is a valid page number.
protected
isValidPageNumber(int $page) : bool
Parameters
- $page : int