LengthAwarePaginator
class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, LengthAwarePaginator (View source)
Traits
Properties
protected TValue> | $items | All of the items being paginated. |
from AbstractPaginator |
protected int | $perPage | The number of items to be shown per page. |
from AbstractPaginator |
protected int | $currentPage | The current page being "viewed". |
from AbstractPaginator |
protected string | $path | The base path to assign to all URLs. |
from AbstractPaginator |
protected array | $query | The query parameters to add to all URLs. |
from AbstractPaginator |
protected string|null | $fragment | The URL fragment to add to all URLs. |
from AbstractPaginator |
protected string | $pageName | The query string variable used to store the page. |
from AbstractPaginator |
int | $onEachSide | The number of links to display on each side of current page link. |
from AbstractPaginator |
protected array | $options | The paginator options. |
from AbstractPaginator |
static protected Closure | $currentPathResolver | The current path resolver callback. |
from AbstractPaginator |
static protected Closure | $currentPageResolver | The current page resolver callback. |
from AbstractPaginator |
static protected Closure | $queryStringResolver | The query string resolver callback. |
from AbstractPaginator |
static protected Closure | $viewFactoryResolver | The view factory resolver callback. |
from AbstractPaginator |
static string | $defaultView | The default pagination view. |
from AbstractPaginator |
static string | $defaultSimpleView | The default "simple" pagination view. |
from AbstractPaginator |
protected int | $total | The total number of items before slicing. |
|
protected int | $lastPage | The last available page. |
Methods
Forward a method call to the given object.
Forward a method call to the given object, returning $this if the forwarded call returned itself.
Throw a bad method call exception for the given method.
Call the given Closure with this instance then return the instance.
Determine if the given value is a valid page number.
Get / set the URL fragment to be appended to URLs.
Add a set of query string values to the paginator.
Add all current query string values to the paginator.
Add a query string value to the paginator.
Load a set of relationships onto the mixed relationship collection.
Load a set of relationship counts onto the mixed relationship collection.
Transform each item in the slice of items using a callback.
Determine if there are enough items to split into multiple pages.
Set the query string variable used to store the page.
Set the number of links to display on each side of current page link.
Resolve the current request path or return the default value.
Resolve the current page or return the default value.
Resolve the query string or return the default value.
Get an instance of the view factory from the resolver.
Set the default "simple" pagination view.
Indicate that Tailwind styling should be used for generated links.
Indicate that Bootstrap 4 styling should be used for generated links.
Indicate that Bootstrap 3 styling should be used for generated links.
Indicate that Bootstrap 4 styling should be used for generated links.
Indicate that Bootstrap 5 styling should be used for generated links.
Set the item at the given offset.
Make dynamic calls into the collection.
Render the contents of the paginator when casting to a string.
Create a new paginator instance.
Get the current page for the request.
Render the paginator using the given view.
Render the paginator using the given view.
Get the paginator links as a collection (for JSON responses).
Get the array of elements to pass to the view.
Get the total number of items being paginated.
Determine if there are more items in the data source.
Get the URL for the next page.
Get the last page.
Get the instance as an array.
Convert the object into something JSON serializable.
Convert the object to its JSON representation.
Details
protected mixed
forwardCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object.
protected mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object, returning $this if the forwarded call returned itself.
static protected never
throwBadMethodCallException(string $method)
Throw a bad method call exception for the given method.
$this|string|null
fragment(string|null $fragment = null)
Get / set the URL fragment to be appended to URLs.
$this
appends(array|string|null $key, string|null $value = null)
Add a set of query string values to the paginator.
$this
loadMorph(string $relation, array $relations)
Load a set of relationships onto the mixed relationship collection.
$this
loadMorphCount(string $relation, array $relations)
Load a set of relationship counts onto the mixed relationship collection.
static string
resolveCurrentPath(string $default = '/')
Resolve the current request path or return the default value.
static int
resolveCurrentPage(string $pageName = 'page', int $default = 1)
Resolve the current page or return the default value.
static string
resolveQueryString(string|array|null $default = null)
Resolve the query string or return the default value.
static void
useBootstrapThree()
Indicate that Bootstrap 3 styling should be used for generated links.
static void
useBootstrapFour()
Indicate that Bootstrap 4 styling should be used for generated links.
static void
useBootstrapFive()
Indicate that Bootstrap 5 styling should be used for generated links.
__construct(TValue>|TValue>|TValue>|null $items, int $total, int $perPage, int|null $currentPage = null, array $options = [])
Create a new paginator instance.
protected int
setCurrentPage(int $currentPage, string $pageName)
Get the current page for the request.
Htmlable
links(string|null $view = null, array $data = [])
Render the paginator using the given view.
string
render(string|null $view = null, array $data = [])
Render the paginator using the given view.