AbstractPaginator
abstract class AbstractPaginator implements Htmlable (View source)
Properties
protected Collection | $items | All of the items being paginated. | |
protected int | $perPage | The number of items to be shown per page. | |
protected int | $currentPage | The current page being "viewed". | |
protected string | $path | The base path to assign to all URLs. | |
protected array | $query | The query parameters to add to all URLs. | |
protected string|null | $fragment | The URL fragment to add to all URLs. | |
protected string | $pageName | The query string variable used to store the page. | |
static protected Closure | $currentPathResolver | The current path resolver callback. | |
static protected Closure | $currentPageResolver | The current page resolver callback. | |
static protected Closure | $viewFactoryResolver | The view factory resolver callback. | |
static string | $defaultView | The default pagination view. | |
static string | $defaultSimpleView | The default "simple" pagination view. |
Methods
Determine if the given value is a valid page number.
Get the URL for the previous page.
Create a range of pagination URLs.
Get the URL for a given page number.
Get / set the URL fragment to be appended to URLs.
Add a set of query string values to the paginator.
Add an array of query string values.
Add a query string value to the paginator.
Build the full fragment portion of a URL.
Load a set of relationships onto the mixed relationship collection.
Get the slice of items being paginated.
Get the number of the first item in the slice.
Get the number of the last item in the slice.
Get the number of items shown per page.
Determine if there are enough items to split into multiple pages.
Determine if the paginator is on the first page.
Get the current page.
Get the query string variable used to store the page.
Set the query string variable used to store the page.
Set the base path to assign to all URLs.
Set the base path to assign to all URLs.
Resolve the current request path or return the default value.
Resolve the current page or return the default value.
Get an instance of the view factory from the resolver.
Set the default pagination view.
Set the default "simple" pagination view.
Indicate that Bootstrap 3 styling should be used for generated links.
Get an iterator for the items.
Determine if the list of items is empty.
Determine if the list of items is not empty.
Get the number of items for the current page.
Get the paginator's underlying collection.
Determine if the given item exists.
Get the item at the given offset.
Set the item at the given offset.
Unset the item at the given key.
Render the contents of the paginator to HTML.
Make dynamic calls into the collection.
Render the contents of the paginator when casting to string.
Details
at line 105
protected bool
isValidPageNumber(int $page)
Determine if the given value is a valid page number.
at line 115
string|null
previousPageUrl()
Get the URL for the previous page.
at line 129
array
getUrlRange(int $start, int $end)
Create a range of pagination URLs.
at line 142
string
url(int $page)
Get the URL for a given page number.
at line 169
$this|string|null
fragment(string|null $fragment = null)
Get / set the URL fragment to be appended to URLs.
at line 187
$this
appends(array|string $key, string|null $value = null)
Add a set of query string values to the paginator.
at line 202
protected $this
appendArray(array $keys)
Add an array of query string values.
at line 218
protected $this
addQuery(string $key, string $value)
Add a query string value to the paginator.
at line 232
protected string
buildFragment()
Build the full fragment portion of a URL.
at line 244
$this
loadMorph(string $relation, array $relations)
Load a set of relationships onto the mixed relationship collection.
at line 256
array
items()
Get the slice of items being paginated.
at line 266
int
firstItem()
Get the number of the first item in the slice.
at line 276
int
lastItem()
Get the number of the last item in the slice.
at line 286
int
perPage()
Get the number of items shown per page.
at line 296
bool
hasPages()
Determine if there are enough items to split into multiple pages.
at line 306
bool
onFirstPage()
Determine if the paginator is on the first page.
at line 316
int
currentPage()
Get the current page.
at line 326
string
getPageName()
Get the query string variable used to store the page.
at line 337
$this
setPageName(string $name)
Set the query string variable used to store the page.
at line 350
$this
withPath(string $path)
Set the base path to assign to all URLs.
at line 361
$this
setPath(string $path)
Set the base path to assign to all URLs.
at line 374
static string
resolveCurrentPath(string $default = '/')
Resolve the current request path or return the default value.
at line 389
static void
currentPathResolver(Closure $resolver)
Set the current request path resolver callback.
at line 401
static int
resolveCurrentPage(string $pageName = 'page', int $default = 1)
Resolve the current page or return the default value.
at line 416
static void
currentPageResolver(Closure $resolver)
Set the current page resolver callback.
at line 437
static void
viewFactoryResolver(Closure $resolver)
Set the view factory resolver callback.
at line 448
static void
defaultView(string $view)
Set the default pagination view.
at line 459
static void
defaultSimpleView(string $view)
Set the default "simple" pagination view.
at line 469
static void
useBootstrapThree()
Indicate that Bootstrap 3 styling should be used for generated links.
at line 480
ArrayIterator
getIterator()
Get an iterator for the items.
at line 490
bool
isEmpty()
Determine if the list of items is empty.
at line 500
bool
isNotEmpty()
Determine if the list of items is not empty.
at line 510
int
count()
Get the number of items for the current page.
at line 520
Collection
getCollection()
Get the paginator's underlying collection.
at line 531
$this
setCollection(Collection $collection)
Set the paginator's underlying collection.
at line 544
bool
offsetExists(mixed $key)
Determine if the given item exists.
at line 555
mixed
offsetGet(mixed $key)
Get the item at the given offset.
at line 567
void
offsetSet(mixed $key, mixed $value)
Set the item at the given offset.
at line 578
void
offsetUnset(mixed $key)
Unset the item at the given key.
at line 588
string
toHtml()
Render the contents of the paginator to HTML.
at line 600
mixed
__call(string $method, array $parameters)
Make dynamic calls into the collection.
at line 610
string
__toString()
Render the contents of the paginator when casting to string.