trait DelegatesToResource

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable

Methods

mixed
forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

static never
throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically pass method calls to the underlying resource.

mixed
getRouteKey()

Get the value of the resource's route key.

string
getRouteKeyName()

Get the route key for the resource.

never
resolveRouteBinding(mixed $value, string|null $field = null)

Retrieve the model for a bound value.

Model|null
resolveChildRouteBinding(string $childType, mixed $value, string|null $field = null)

Retrieve the model for a bound value.

bool
offsetExists(mixed $offset)

Determine if the given attribute exists.

mixed
offsetGet(mixed $offset)

Get the value for a given offset.

void
offsetSet(mixed $offset, mixed $value)

Set the value for a given offset.

void
offsetUnset(mixed $offset)

Unset the value for a given offset.

bool
__isset(string $key)

Determine if an attribute exists on the resource.

void
__unset(string $key)

Unset an attribute on the resource.

mixed
__get(string $key)

Dynamically get properties from the underlying resource.

Details

in ForwardsCalls at line 22
protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 52
protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ForwardsCalls at line 66
static protected never throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

Parameters

string $method

Return Value

never

Exceptions

BadMethodCallException

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.

Parameters

string $name
callable|object $macro

Return Value

void

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.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

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.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 113
mixed __call(string $method, array $parameters)

Dynamically pass method calls to the underlying resource.

Parameters

string $method
array $parameters

Return Value

mixed

at line 21
mixed getRouteKey()

Get the value of the resource's route key.

Return Value

mixed

at line 29
string getRouteKeyName()

Get the route key for the resource.

Return Value

string

at line 39
never resolveRouteBinding(mixed $value, string|null $field = null)

Retrieve the model for a bound value.

Parameters

mixed $value
string|null $field

Return Value

never

Exceptions

Exception

at line 49
Model|null resolveChildRouteBinding(string $childType, mixed $value, string|null $field = null)

Retrieve the model for a bound value.

Parameters

string $childType
mixed $value
string|null $field

Return Value

Model|null

Exceptions

Exception

at line 57
bool offsetExists(mixed $offset)

Determine if the given attribute exists.

Parameters

mixed $offset

Return Value

bool

at line 65
mixed offsetGet(mixed $offset)

Get the value for a given offset.

Parameters

mixed $offset

Return Value

mixed

at line 73
void offsetSet(mixed $offset, mixed $value)

Set the value for a given offset.

Parameters

mixed $offset
mixed $value

Return Value

void

at line 81
void offsetUnset(mixed $offset)

Unset the value for a given offset.

Parameters

mixed $offset

Return Value

void

at line 89
bool __isset(string $key)

Determine if an attribute exists on the resource.

Parameters

string $key

Return Value

bool

at line 97
void __unset(string $key)

Unset an attribute on the resource.

Parameters

string $key

Return Value

void

at line 105
mixed __get(string $key)

Dynamically get properties from the underlying resource.

Parameters

string $key

Return Value

mixed