ConditionallyLoadsAttributes
trait ConditionallyLoadsAttributes (View source)
Methods
Filter the given data, removing any optional values.
Merge the given data in at the given index.
Retrieve a value based on a given condition.
Merge a value based on a given condition.
Merge the given attributes.
Retrieve a relationship if it has been loaded.
Execute a callback if the given pivot table has been loaded.
Transform the given value if it is present.
Details
protected array
filter(array $data)
Filter the given data, removing any optional values.
protected array
merge(array $data, int $index, array $merge)
Merge the given data in at the given index.
protected MissingValue|mixed
when(bool $condition, mixed $value, mixed $default = null)
Retrieve a value based on a given condition.
protected MissingValue|mixed
mergeWhen(bool $condition, mixed $value)
Merge a value based on a given condition.
protected MergeValue
attributes(array $attributes)
Merge the given attributes.
protected MissingValue|mixed
whenLoaded(string $relationship, mixed $value = null, mixed $default = null)
Retrieve a relationship if it has been loaded.
protected MissingValue|mixed
whenPivotLoaded(string $table, mixed $value, mixed $default = null)
Execute a callback if the given pivot table has been loaded.
protected mixed
transform(mixed $value, callable $callback, mixed $default = null)
Transform the given value if it is present.