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

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.

bool
shouldDefer()

Determine if this property should be deferred.

string
group()

Get the defer group for this property.

merge()

Mark the property for merging.

deepMerge()

Mark the property for deep merging.

matchOn(string|array $matchOn)

Set the properties to match on for merging.

bool
shouldMerge()

Determine if the property should be merged.

bool
shouldDeepMerge()

Determine if the property should be deep merged.

array
matchesOn()

Get the properties to match on for merging.

bool
appendsAtRoot()

Determine if the property should be appended at the root level.

bool
prependsAtRoot()

Determine if the property should be prepended at the root level.

bool
mergesAtRoot()

Determine if the property merges at the root level.

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.

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.

array
appendsAtPaths()

Get the paths to append.

array
prependsAtPaths()

Get the paths to prepend.

mixed
resolveCallable(mixed $value)

Call the given value if callable and inject its dependencies.

bool
useAsCallable(mixed $value)

Determine if the given value is callable, but not a string.

__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.

configureMergeIntent(Request|null $request = null)

Configure the merge strategy based on the infinite scroll merge intent header.

resolveMetadataProvider()

Resolve the scroll metadata provider.

array
metadata()

Get the pagination meta information.

mixed
__invoke()

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.

Parameters

string|null $group

Return Value

DefersProps

in DefersProps at line 35
bool shouldDefer()

Determine if this property should be deferred.

Return Value

bool

in DefersProps at line 43
string group()

Get the defer group for this property.

Return Value

string

in MergesProps at line 50
MergesProps merge()

Mark the property for merging.

Return Value

MergesProps

in MergesProps at line 60
MergesProps deepMerge()

Mark the property for deep merging.

Return Value

MergesProps

in MergesProps at line 72
MergesProps matchOn(string|array $matchOn)

Set the properties to match on for merging.

Parameters

string|array $matchOn

Return Value

MergesProps

in MergesProps at line 82
bool shouldMerge()

Determine if the property should be merged.

Return Value

bool

in MergesProps at line 90
bool shouldDeepMerge()

Determine if the property should be deep merged.

Return Value

bool

in MergesProps at line 100
array matchesOn()

Get the properties to match on for merging.

Return Value

array

in MergesProps at line 108
bool appendsAtRoot()

Determine if the property should be appended at the root level.

Return Value

bool

in MergesProps at line 116
bool prependsAtRoot()

Determine if the property should be prepended at the root level.

Return Value

bool

in MergesProps at line 124
protected bool mergesAtRoot()

Determine if the property merges at the root level.

Return Value

bool

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.

Parameters

bool|string|array $path
string|null $matchOn

Return Value

MergesProps

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.

Parameters

bool|string|array $path
string|null $matchOn

Return Value

MergesProps

in MergesProps at line 178
array appendsAtPaths()

Get the paths to append.

Return Value

array

in MergesProps at line 188
array prependsAtPaths()

Get the paths to prepend.

Return Value

array

in ResolvesCallables at line 14
protected mixed resolveCallable(mixed $value)

Call the given value if callable and inject its dependencies.

Parameters

mixed $value

Return Value

mixed

in ResolvesCallables at line 22
protected bool useAsCallable(mixed $value)

Determine if the given value is callable, but not a string.

Parameters

mixed $value

Return Value

bool

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.

Parameters

mixed $value
string $wrapper
ProvidesScrollMetadata|callable|null $metadata

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.

Parameters

Request|null $request

Return Value

ScrollProp

at line 86
protected ProvidesScrollMetadata resolveMetadataProvider()

Resolve the scroll metadata provider.

Return Value

ProvidesScrollMetadata

at line 106
array metadata()

Get the pagination meta information.

Return Value

array

at line 123
mixed __invoke()

Resolve the property value.

Return Value

mixed