CursorPaginator
class CursorPaginator extends AbstractCursorPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, CursorPaginator (View source)
Traits
Properties
protected TValue> | $items | All of the items being paginated. |
from AbstractCursorPaginator |
protected int | $perPage | The number of items to be shown per page. |
from AbstractCursorPaginator |
protected string | $path | The base path to assign to all URLs. |
from AbstractCursorPaginator |
protected array | $query | The query parameters to add to all URLs. |
from AbstractCursorPaginator |
protected string|null | $fragment | The URL fragment to add to all URLs. |
from AbstractCursorPaginator |
protected string | $cursorName | The cursor string variable used to store the page. |
from AbstractCursorPaginator |
protected Cursor|null | $cursor | The current cursor. |
from AbstractCursorPaginator |
protected array | $parameters | The paginator parameters for the cursor. |
from AbstractCursorPaginator |
protected array | $options | The paginator options. |
from AbstractCursorPaginator |
static protected Closure | $currentCursorResolver | The current cursor resolver callback. |
from AbstractCursorPaginator |
protected | $hasMore | Indicates whether there are more items in the data source. |
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.
Get the "cursor" that points to the previous set of items.
Get the "cursor" that points to the next set of items.
Get a cursor instance for the given item.
Get the cursor parameter value from a pivot model if applicable.
Ensure the parameter is a primitive type.
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.
Get the query string variable used to store the cursor.
Set the query string variable used to store the cursor.
Resolve the current cursor or return the default value.
Get an instance of the view factory from the resolver.
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.
Set the items for the paginator.
Render the paginator using the given view.
Render the paginator using the given view.
Determine if there are more items in the data source.
Determine if there are enough items to split into multiple pages.
Determine if the paginator is on the first page.
Determine if the paginator is on 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.
Cursor
getCursorForItem(ArrayAccess|stdClass $item, bool $isNext = true)
Get a cursor instance for the given item.
array
getParametersForItem(ArrayAccess|stdClass $item)
Get the cursor parameters for a given object.
protected string|null
getPivotParameterForItem(ArrayAccess|stdClass $item, string $parameterName)
Get the cursor parameter value from a pivot model if applicable.
protected mixed
ensureParameterIsPrimitive(mixed $parameter)
Ensure the parameter is a primitive type.
This can resolve issues that arise the developer uses a value object for an attribute.
$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 Cursor|null
resolveCurrentCursor(string $cursorName = 'cursor', $default = null)
Resolve the current cursor or return the default value.
__construct(TValue>|TValue>|TValue>|null $items, int $perPage, Cursor|null $cursor = null, array $options = [])
Create a new paginator instance.
Htmlable
links(string|null $view = null, array $data = [])
Render the paginator using the given view.