ScrollProp
class ScrollProp implements Deferrable, Mergeable
Represents a paginated property that can be merged during partial reloads.
This class provides functionality for handling pagination data with merge capabilities, allowing paginated content to be appended or prepended during client-side navigation.
Traits
Properties
| protected bool | $deferred | Indicates if the property should be deferred. |
from DefersProps |
| protected string|null | $deferGroup | The defer group. |
from DefersProps |
| protected bool | $merge | Indicates if the property should be merged. |
from MergesProps |
| protected bool | $deepMerge | Indicates if the property should be deep merged. |
from MergesProps |
| protected array<int, string> | $matchOn | The properties to match on for merging. |
from MergesProps |
| protected bool | $append | Indicates if the property values should be appended or prepended. |
from MergesProps |
| protected array<int, string> | $appendsAtPaths | The paths to append. |
from MergesProps |
| protected array<int, string> | $prependsAtPaths | The paths to prepend. |
from MergesProps |
| protected T | $value | The property value. |
|
| protected T | $resolved | The resolved property value. |
|
| protected string | $wrapper | The wrapper key for the data array. |
|
| protected null|ProvidesScrollMetadata|ProvidesScrollMetadata | $metadata | The scroll metadata provider. |
Methods
Mark this property as deferred. Deferred properties are excluded from the initial page load and only evaluated when requested by the frontend, improving initial page performance.
Set the properties to match on for merging.
Determine if the property should be appended at the root level.
Determine if the property should be prepended at the root level.
Specify that the value should be appended, optionally providing a key to append and a property to match on.
Specify that the value should be prepended, optionally providing a key to prepend and a property to match on.
Call the given value if callable and inject its dependencies.
Determine if the given value is callable, but not a string.
Create a new merge property instance. Merge properties are combined with existing client-side data during partial reloads instead of completely replacing the property value.
Configure the merge strategy based on the infinite scroll merge intent header.
Resolve the scroll metadata provider.
Get the pagination meta information.
Resolve the property value.
Details
in
DefersProps at line 24
DefersProps
defer(string|null $group = null)
Mark this property as deferred. Deferred properties are excluded from the initial page load and only evaluated when requested by the frontend, improving initial page performance.
in
DefersProps at line 35
bool
shouldDefer()
Determine if this property should be deferred.
in
DefersProps at line 43
string
group()
Get the defer group for this property.
in
MergesProps at line 50
MergesProps
merge()
Mark the property for merging.
in
MergesProps at line 60
MergesProps
deepMerge()
Mark the property for deep merging.
in
MergesProps at line 72
MergesProps
matchOn(string|array $matchOn)
Set the properties to match on for merging.
in
MergesProps at line 82
bool
shouldMerge()
Determine if the property should be merged.
in
MergesProps at line 90
bool
shouldDeepMerge()
Determine if the property should be deep merged.
in
MergesProps at line 100
array
matchesOn()
Get the properties to match on for merging.
in
MergesProps at line 108
bool
appendsAtRoot()
Determine if the property should be appended at the root level.
in
MergesProps at line 116
bool
prependsAtRoot()
Determine if the property should be prepended at the root level.
in
MergesProps at line 124
protected bool
mergesAtRoot()
Determine if the property merges at the root level.
in
MergesProps at line 134
MergesProps
append(bool|string|array $path = true, string|null $matchOn = null)
Specify that the value should be appended, optionally providing a key to append and a property to match on.
in
MergesProps at line 156
MergesProps
prepend(bool|string|array $path = true, string|null $matchOn = null)
Specify that the value should be prepended, optionally providing a key to prepend and a property to match on.
in
MergesProps at line 178
array
appendsAtPaths()
Get the paths to append.
in
MergesProps at line 188
array
prependsAtPaths()
Get the paths to prepend.
in
ResolvesCallables at line 14
protected mixed
resolveCallable(mixed $value)
Call the given value if callable and inject its dependencies.
in
ResolvesCallables at line 22
protected bool
useAsCallable(mixed $value)
Determine if the given value is callable, but not a string.
at line 60
__construct(mixed $value, string $wrapper = 'data', ProvidesScrollMetadata|callable|null $metadata = null)
Create a new merge property instance. Merge properties are combined with existing client-side data during partial reloads instead of completely replacing the property value.
at line 74
ScrollProp
configureMergeIntent(Request|null $request = null)
Configure the merge strategy based on the infinite scroll merge intent header.
The frontend InfiniteScroll component sends its merge intent directly, eliminating the need for direction-based logic on the backend.
at line 86
protected ProvidesScrollMetadata
resolveMetadataProvider()
Resolve the scroll metadata provider.
at line 106
array
metadata()
Get the pagination meta information.
at line 123
mixed
__invoke()
Resolve the property value.