RelationalLazy
class RelationalLazy extends Lazy
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected bool|null | $defaultIncluded | from Lazy |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a lazy value for a loaded model relation.
Create an Inertia deferred prop.
Resolve the relationship value.
Get the serializable lazy state.
Restore serialized lazy state.
Include this value without an explicit partial selection.
Determine if the relationship is loaded.
Details
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.
in
Lazy at line 28
static DefaultLazy
create(Closure $value)
Create a lazy value.
in
Lazy at line 36
static ConditionalLazy
when(Closure $condition, Closure $value)
Create a conditionally included lazy value.
in
Lazy at line 44
static RelationalLazy
whenLoaded(string $relation, Model $model, Closure $value)
Create a lazy value for a loaded model relation.
in
Lazy at line 52
static InertiaLazy
inertia(Closure $value)
Create an Inertia lazy prop.
in
Lazy at line 60
static InertiaDeferred
inertiaDeferred(mixed $value, string|null $group = null, bool $rescue = false)
Create an Inertia deferred prop.
in
Lazy at line 71
static ClosureLazy
closure(Closure $closure)
Lazily expose a closure as the resolved value.
at line 27
mixed
resolve()
Resolve the relationship value.
at line 43
array
__serialize()
Get the serializable lazy state.
at line 56
void
__unserialize(array $data)
Restore serialized lazy state.
in
Lazy at line 94
Lazy
defaultIncluded(bool $defaultIncluded = true)
Include this value without an explicit partial selection.
in
Lazy at line 104
bool
isDefaultIncluded()
Determine if this value is included by default.
at line 35
bool|null
shouldBeIncluded()
Determine if the relationship is loaded.
in
Lazy at line 120
bool
resolvesToData()
Determine if resolving this lazy value produces data.
in
Lazy at line 128
mixed
__get(string $name)
Forward property access to the resolved value.