class Illuminate / Pagination / AbstractPaginator
abstract

AbstractPaginator

Implements

Uses

Properties

protected

$items Illuminate\...\Collection

All of the items being paginated.

Default: null
protected

$perPage int

The number of items to be shown per page.

Default: null
protected

$currentPage int

The current page being "viewed".

Default: null
protected

$path string

The base path to assign to all URLs.

Default: '/'
protected

$query array

The query parameters to add to all URLs.

Default: []
protected

$fragment string|null

The URL fragment to add to all URLs.

Default: null
protected

$pageName string

The query string variable used to store the page.

Default: 'page'
public

$onEachSide int

The number of links to display on each side of current page link.

Default: 3
protected

$options array

The paginator options.

Default: null
protected static

$currentPathResolver Closure

The current path resolver callback.

Default: null
protected static

$currentPageResolver Closure

The current page resolver callback.

Default: null
protected static

$queryStringResolver Closure

The query string resolver callback.

Default: null
protected static

$viewFactoryResolver Closure

The view factory resolver callback.

Default: null
public static

$defaultView string

The default pagination view.

Default: 'pagination::tailwind'
public static

$defaultSimpleView string

The default "simple" pagination view.

Default: 'pagination::simple-tailwind'

Methods

protected

isValidPageNumber ( $page ) : bool

Determine if the given value is a valid page number.

Parameters

  • $page int
public

previousPageUrl ( ) : string|null

Get the URL for the previous page.

public

getUrlRange ( $start , $end ) : array

Create a range of pagination URLs.

Parameters

  • $start int
  • $end int
public

url ( $page ) : string

Get the URL for a given page number.

Parameters

  • $page int
public

fragment ( $fragment ) : $this|string|null

Get / set the URL fragment to be appended to URLs.

Parameters

  • $fragment string|null
public

appends ( $key , $value ) : $this

Add a set of query string values to the paginator.

Parameters

  • $key array|string|null
  • $value string|null
protected

appendArray ( array $keys ) : $this

Add an array of query string values.

Parameters

  • $keys array
public

withQueryString ( ) : $this

Add all current query string values to the paginator.

protected

addQuery ( $key , $value ) : $this

Add a query string value to the paginator.

Parameters

  • $key string
  • $value string
protected

buildFragment ( ) : string

Build the full fragment portion of a URL.

public

loadMorph ( $relation , $relations ) : $this

Load a set of relationships onto the mixed relationship collection.

Parameters

  • $relation string
  • $relations array
public

loadMorphCount ( $relation , $relations ) : $this

Load a set of relationship counts onto the mixed relationship collection.

Parameters

  • $relation string
  • $relations array
public

items ( ) : array

Get the slice of items being paginated.

public

firstItem ( ) : int|null

Get the number of the first item in the slice.

public

lastItem ( ) : int|null

Get the number of the last item in the slice.

public

through ( callable $callback ) : $this

Transform each item in the slice of items using a callback.

Parameters

  • $callback callable
public

perPage ( ) : int

Get the number of items shown per page.

public

hasPages ( ) : bool

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

public

onFirstPage ( ) : bool

Determine if the paginator is on the first page.

public

onLastPage ( ) : bool

Determine if the paginator is on the last page.

public

currentPage ( ) : int

Get the current page.

public

getPageName ( ) : string

Get the query string variable used to store the page.

public

setPageName ( $name ) : $this

Set the query string variable used to store the page.

Parameters

  • $name string
public

withPath ( $path ) : $this

Set the base path to assign to all URLs.

Parameters

  • $path string
public

setPath ( $path ) : $this

Set the base path to assign to all URLs.

Parameters

  • $path string
public

onEachSide ( $count ) : $this

Set the number of links to display on each side of current page link.

Parameters

  • $count int
public

path ( ) : string|null

Get the base path for paginator generated URLs.

public static

resolveCurrentPath ( $default ) : string

Resolve the current request path or return the default value.

Parameters

  • $default string
public static

currentPathResolver ( Closure $resolver ) : void

Set the current request path resolver callback.

Parameters

public static

resolveCurrentPage ( $pageName , $default ) : int

Resolve the current page or return the default value.

Parameters

  • $pageName string
  • $default int
public static

currentPageResolver ( Closure $resolver ) : void

Set the current page resolver callback.

Parameters

public static

resolveQueryString ( $default ) : string

Resolve the query string or return the default value.

Parameters

  • $default string|array|null
public static

queryStringResolver ( Closure $resolver ) : void

Set with query string resolver callback.

Parameters

public static

viewFactory ( ) : Factory

Get an instance of the view factory from the resolver.

public static

viewFactoryResolver ( Closure $resolver ) : void

Set the view factory resolver callback.

Parameters

public static

defaultView ( $view ) : void

Set the default pagination view.

Parameters

  • $view string
public static

defaultSimpleView ( $view ) : void

Set the default "simple" pagination view.

Parameters

  • $view string
public static

useTailwind ( ) : void

Indicate that Tailwind styling should be used for generated links.

public static

useBootstrap ( ) : void

Indicate that Bootstrap 4 styling should be used for generated links.

public static

useBootstrapThree ( ) : void

Indicate that Bootstrap 3 styling should be used for generated links.

public static

useBootstrapFour ( ) : void

Indicate that Bootstrap 4 styling should be used for generated links.

public static

useBootstrapFive ( ) : void

Indicate that Bootstrap 5 styling should be used for generated links.

public

getIterator ( ) : ArrayIterator

Get an iterator for the items.

public

isEmpty ( ) : bool

Determine if the list of items is empty.

public

isNotEmpty ( ) : bool

Determine if the list of items is not empty.

public

count ( ) : int

Get the number of items for the current page.

public

getCollection ( ) : Illuminate\...\Collection

Get the paginator's underlying collection.

public

setCollection ( Illuminate\...\Collection $collection ) : $this

Set the paginator's underlying collection.

Parameters

  • $collection Illuminate\...\Collection
public

getOptions ( ) : array

Get the paginator options.

public

offsetExists ( $key ) : bool

Determine if the given item exists.

Parameters

  • $key mixed
public

offsetGet ( $key ) : mixed

Get the item at the given offset.

Parameters

  • $key mixed
public

offsetSet ( $key , $value ) : void

Set the item at the given offset.

Parameters

  • $key mixed
  • $value mixed
public

offsetUnset ( $key ) : void

Unset the item at the given key.

Parameters

  • $key mixed
public

toHtml ( ) : string

Render the contents of the paginator to HTML.

public

__call ( $method , $parameters ) : mixed

Make dynamic calls into the collection.

Parameters

  • $method string
  • $parameters array
public

__toString ( ) : string

Render the contents of the paginator when casting to a string.