CursorPaginatedDataCollection
class CursorPaginatedDataCollection implements BaseDataCollectable, TransformableData, IncludeableData, ResponsableData, WrappableData, Countable, Transient
Traits
Properties
| protected PartialsDefinition|false|null | $partialDefinitions | Null before defaults are inspected, false when they are empty, or the mutable definition store. |
from IncludeableData |
| protected Wrap|null | $wrap | from WrappableData | |
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected TValue> | $items |
Methods
Get the current partial definitions.
Include properties for the next transformation.
Include properties for every transformation.
Exclude lazy properties for the next transformation.
Exclude lazy properties for every transformation.
Keep only properties for the next transformation.
Keep only properties for every transformation.
Exclude properties for the next transformation.
Exclude properties for every transformation.
Include a property when the condition passes.
Exclude a lazy property when the condition passes.
Exclude a property when the condition passes.
Determine whether this object has partial definitions.
Get the JSON serialization options for the resource response.
Get the request properties that may be included.
Get the request properties that may be excluded.
Get the request properties allowed by an only selection.
Get the request properties allowed by an except selection.
Get original collection items without transforming or enumerating them twice.
Transform the data object to an array.
Convert the data object to its JSON representation.
Resolve the collection's active partials for items read from it.
Get the underlying items without transforming them.
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a typed cursor-paginated data collection.
Get the underlying cursor paginator.
Details
in
BaseDataCollectable at line 74
abstract PartialsDefinition
getPartialsDefinition()
Get the current partial definitions.
in
ForwardsToPartialsDefinition at line 19
ForwardsToPartialsDefinition
include(string ...$includes)
Include properties for the next transformation.
in
ForwardsToPartialsDefinition at line 31
ForwardsToPartialsDefinition
includePermanently(string ...$includes)
Include properties for every transformation.
in
ForwardsToPartialsDefinition at line 43
ForwardsToPartialsDefinition
exclude(string ...$excludes)
Exclude lazy properties for the next transformation.
in
ForwardsToPartialsDefinition at line 55
ForwardsToPartialsDefinition
excludePermanently(string ...$excludes)
Exclude lazy properties for every transformation.
in
ForwardsToPartialsDefinition at line 67
ForwardsToPartialsDefinition
only(string ...$only)
Keep only properties for the next transformation.
in
ForwardsToPartialsDefinition at line 79
ForwardsToPartialsDefinition
onlyPermanently(string ...$only)
Keep only properties for every transformation.
in
ForwardsToPartialsDefinition at line 91
ForwardsToPartialsDefinition
except(string ...$except)
Exclude properties for the next transformation.
in
ForwardsToPartialsDefinition at line 103
ForwardsToPartialsDefinition
exceptPermanently(string ...$except)
Exclude properties for every transformation.
in
ForwardsToPartialsDefinition at line 115
ForwardsToPartialsDefinition
includeWhen(string $include, bool|Closure $condition, bool $permanent = false)
Include a property when the condition passes.
in
ForwardsToPartialsDefinition at line 132
ForwardsToPartialsDefinition
excludeWhen(string $exclude, bool|Closure $condition, bool $permanent = false)
Exclude a lazy property when the condition passes.
in
ForwardsToPartialsDefinition at line 149
ForwardsToPartialsDefinition
onlyWhen(string $only, bool|Closure $condition, bool $permanent = false)
Keep only a property when the condition passes.
in
ForwardsToPartialsDefinition at line 166
ForwardsToPartialsDefinition
exceptWhen(string $except, bool|Closure $condition, bool $permanent = false)
Exclude a property when the condition passes.
in
BaseDataCollectable at line 69
abstract bool
hasPartialsDefinition()
Determine whether this object has partial definitions.
in
IncludeableData at line 88
protected array
includeProperties()
Get class-owned permanent include definitions.
in
IncludeableData at line 96
protected array
excludeProperties()
Get class-owned permanent exclude definitions.
in
IncludeableData at line 104
protected array
onlyProperties()
Get class-owned permanent only definitions.
in
IncludeableData at line 112
protected array
exceptProperties()
Get class-owned permanent except definitions.
in
ResponsableData at line 28
JsonResponse
toResponse(Request $request)
Create an HTTP response that represents the data object.
in
ResponsableData at line 69
static int
jsonOptions()
Get the JSON serialization options for the resource response.
in
ResponsableData at line 77
void
withResponse(Request $request, JsonResponse $response)
Customize the outgoing resource response.
in
ResponsableData at line 84
static array|null
allowedRequestIncludes()
Get the request properties that may be included.
in
ResponsableData at line 92
static array|null
allowedRequestExcludes()
Get the request properties that may be excluded.
in
ResponsableData at line 100
static array|null
allowedRequestOnly()
Get the request properties allowed by an only selection.
in
ResponsableData at line 108
static array|null
allowedRequestExcept()
Get the request properties allowed by an except selection.
in
ResponsableData at line 118
protected Collection
responseItems(BaseDataCollectable $data)
Get original collection items without transforming or enumerating them twice.
in
TransformableData at line 20
array
transform(TransformationContextFactory|TransformationContext|null $transformationContext = null)
Transform the data object to an array.
in
TransformableData at line 38
array
all()
Get all visible properties without transforming their values.
in
TransformableData at line 52
array
toArray()
Get the data object as an array.
in
TransformableData at line 60
string
toJson(int $options = 0)
Convert the data object to its JSON representation.
in
TransformableData at line 70
array
jsonSerialize()
Get the data that should be serialized to JSON.
in
BaseDataCollectable at line 24
string
getDataClass()
Get the data class stored by the collection.
in
BaseDataCollectable at line 34
Generator
getIterator()
Get an iterator for the data items.
in
BaseDataCollectable at line 55
protected array|null
partialsForItems()
Resolve the collection's active partials for items read from it.
As in Spatie, an item read from the collection carries the collection's selections. Reads don't consume the collection's temporary selections; its next transformation does.
in
BaseDataCollectable at line 81
abstract protected iterable
itemsForIteration()
Get the underlying items without transforming them.
in
PaginatedDataCollectable at line 23
PaginatedDataCollectable
through(Closure $through)
No description
in
PaginatedDataCollectable at line 36
int
count()
Get the number of data items on the current page.
in
WrappableData at line 17
WrappableData
withoutWrapping()
Disable wrapping for the data object.
in
WrappableData at line 27
WrappableData
wrap(string $key)
Wrap the data object with the given key.
in
WrappableData at line 37
Wrap
getWrap()
Get the current wrapping definition.
in
Macroable at line 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 54
__construct(string $dataClass, AbstractCursorPaginator $items)
Create a typed cursor-paginated data collection.
at line 70
AbstractCursorPaginator
items()
Get the underlying cursor paginator.