PaginatedDataCollection
class PaginatedDataCollection 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.
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.
Get the underlying paginator.
Details
in
BaseDataCollectable at line 42
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
IncludeableData at line 24
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 67
static int
jsonOptions()
Get the JSON serialization options for the resource response.
in
ResponsableData at line 75
void
withResponse(Request $request, JsonResponse $response)
Customize the outgoing resource response.
in
ResponsableData at line 82
static array|null
allowedRequestIncludes()
Get the request properties that may be included.
in
ResponsableData at line 90
static array|null
allowedRequestExcludes()
Get the request properties that may be excluded.
in
ResponsableData at line 98
static array|null
allowedRequestOnly()
Get the request properties allowed by an only selection.
in
ResponsableData at line 106
static array|null
allowedRequestExcept()
Get the request properties allowed by an except selection.
in
ResponsableData at line 116
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 22
string
getDataClass()
Get the data class stored by the collection.
in
BaseDataCollectable at line 32
Generator
getIterator()
Get an iterator for the data items.
in
BaseDataCollectable at line 49
abstract protected iterable
itemsForIteration()
Get the underlying items without transforming them.
in
PaginatedDataCollectable at line 22
PaginatedDataCollectable
through(Closure $through)
No description
in
PaginatedDataCollectable at line 35
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 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 54
__construct(string $dataClass, AbstractPaginator $items)
Create a typed paginated data collection.
at line 70
AbstractPaginator
items()
Get the underlying paginator.