AbstractPaginator
Implements
Uses
Properties
$perPage int
The number of items to be shown per page.
$currentPage int
The current page being "viewed".
$path string
The base path to assign to all URLs.
$query array
The query parameters to add to all URLs.
$fragment string|null
The URL fragment to add to all URLs.
$pageName string
The query string variable used to store the page.
$onEachSide int
The number of links to display on each side of current page link.
$options array
The paginator options.
$defaultView string
The default pagination view.
$defaultSimpleView string
The default "simple" pagination view.
Methods
isValidPageNumber ( $page ) : bool
Determine if the given value is a valid page number.
Parameters
- $page int
previousPageUrl ( ) : string|null
Get the URL for the previous page.
getUrlRange ( $start , $end ) : array
Create a range of pagination URLs.
Parameters
- $start int
- $end int
url ( $page ) : string
Get the URL for a given page number.
Parameters
- $page int
fragment ( $fragment ) : $this|string|null
Get / set the URL fragment to be appended to URLs.
Parameters
- $fragment string|null
appends ( $key , $value ) : $this
Add a set of query string values to the paginator.
Parameters
- $key array|string|null
- $value string|null
appendArray ( array $keys ) : $this
Add an array of query string values.
Parameters
- $keys array
withQueryString ( ) : $this
Add all current query string values to the paginator.
addQuery ( $key , $value ) : $this
Add a query string value to the paginator.
Parameters
- $key string
- $value string
buildFragment ( ) : string
Build the full fragment portion of a URL.
loadMorph ( $relation , $relations ) : $this
Load a set of relationships onto the mixed relationship collection.
Parameters
- $relation string
- $relations array
loadMorphCount ( $relation , $relations ) : $this
Load a set of relationship counts onto the mixed relationship collection.
Parameters
- $relation string
- $relations array
items ( ) : array
Get the slice of items being paginated.
firstItem ( ) : int
Get the number of the first item in the slice.
lastItem ( ) : int
Get the number of the last item in the slice.
through ( callable $callback ) : $this
Transform each item in the slice of items using a callback.
Parameters
- $callback callable
perPage ( ) : int
Get the number of items shown per page.
hasPages ( ) : bool
Determine if there are enough items to split into multiple pages.
onFirstPage ( ) : bool
Determine if the paginator is on the first page.
onLastPage ( ) : bool
Determine if the paginator is on the last page.
currentPage ( ) : int
Get the current page.
getPageName ( ) : string
Get the query string variable used to store the page.
setPageName ( $name ) : $this
Set the query string variable used to store the page.
Parameters
- $name string
withPath ( $path ) : $this
Set the base path to assign to all URLs.
Parameters
- $path string
setPath ( $path ) : $this
Set the base path to assign to all URLs.
Parameters
- $path string
onEachSide ( $count ) : $this
Set the number of links to display on each side of current page link.
Parameters
- $count int
path ( ) : string|null
Get the base path for paginator generated URLs.
resolveCurrentPath ( $default ) : string
Resolve the current request path or return the default value.
Parameters
- $default string
currentPathResolver ( Closure $resolver ) : void
Set the current request path resolver callback.
Parameters
- $resolver Closure
resolveCurrentPage ( $pageName , $default ) : int
Resolve the current page or return the default value.
Parameters
- $pageName string
- $default int
currentPageResolver ( Closure $resolver ) : void
Set the current page resolver callback.
Parameters
- $resolver Closure
resolveQueryString ( $default ) : string
Resolve the query string or return the default value.
Parameters
- $default string|array|null
queryStringResolver ( Closure $resolver ) : void
Set with query string resolver callback.
Parameters
- $resolver Closure
viewFactoryResolver ( Closure $resolver ) : void
Set the view factory resolver callback.
Parameters
- $resolver Closure
defaultView ( $view ) : void
Set the default pagination view.
Parameters
- $view string
defaultSimpleView ( $view ) : void
Set the default "simple" pagination view.
Parameters
- $view string
useTailwind ( ) : void
Indicate that Tailwind styling should be used for generated links.
useBootstrap ( ) : void
Indicate that Bootstrap 4 styling should be used for generated links.
useBootstrapThree ( ) : void
Indicate that Bootstrap 3 styling should be used for generated links.
isEmpty ( ) : bool
Determine if the list of items is empty.
isNotEmpty ( ) : bool
Determine if the list of items is not empty.
count ( ) : int
Get the number of items for the current page.
setCollection ( Collection $collection ) : $this
Set the paginator's underlying collection.
Parameters
- $collection Collection
getOptions ( ) : array
Get the paginator options.
offsetExists ( $key ) : bool
Determine if the given item exists.
Parameters
- $key mixed
offsetGet ( $key ) : mixed
Get the item at the given offset.
Parameters
- $key mixed
offsetSet ( $key , $value ) : void
Set the item at the given offset.
Parameters
- $key mixed
- $value mixed
offsetUnset ( $key ) : void
Unset the item at the given key.
Parameters
- $key mixed
toHtml ( ) : string
Render the contents of the paginator to HTML.
__call ( $method , $parameters ) : mixed
Make dynamic calls into the collection.
Parameters
- $method string
- $parameters array
__toString ( ) : string
Render the contents of the paginator when casting to a string.