class Repository (View source)
| Conditionable | |
| Macroable | |
| SerializesModels | |
| SerializesAndRestoresModelIdentifiers |
| static protected array | $macros | The registered string macros. | from Macroable |
| protected Dispatcher | $events | The event dispatcher instance. | |
| protected array<string,mixed> | $data | The contextual data. | |
| $hidden | The hidden contextual data. | ||
| static protected callable|null | $handleUnserializeExceptionsUsing | The callback that should handle unserialize exceptions. |
| $this|TWhenReturnType | when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy. | from Conditionable |
| $this|TUnlessReturnType | unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy. | from Conditionable |
| static void | macro(string $name, object|callable $macro)
Register a custom macro. | from Macroable |
| static void | mixin(object $mixin, bool $replace = true)
Mix another object into the class. | from Macroable |
| static bool | hasMacro(string $name)
Checks if macro is registered. | from Macroable |
| static void | flushMacros()
Flush the existing macros. | from Macroable |
| static mixed | __callStatic(string $method, array $parameters)
Dynamically handle calls to the class. | from Macroable |
| mixed | __call(string $method, array $parameters)
Dynamically handle calls to the class. | from Macroable |
| mixed | getSerializedPropertyValue(mixed $value, bool $withRelations = true)
Get the property value prepared for serialization. | from SerializesAndRestoresModelIdentifiers |
| mixed | getRestoredPropertyValue(mixed $value)
Get the restored property value after deserialization. | from SerializesAndRestoresModelIdentifiers |
| Collection | restoreCollection(ModelIdentifier $value)
Restore a queueable collection instance. | from SerializesAndRestoresModelIdentifiers |
| Model | restoreModel(ModelIdentifier $value)
Restore the model from the model identifier instance. | from SerializesAndRestoresModelIdentifiers |
| TModel> | getQueryForModelRestoration(TModel $model, array|int $ids)
Get the query for model restoration. | from SerializesAndRestoresModelIdentifiers |
| array | __serialize()
Prepare the instance values for serialization. | from SerializesModels |
| void | __unserialize(array $values)
Restore the model after serialization. | from SerializesModels |
| mixed | getPropertyValue(ReflectionProperty $property)
Get the property value for the given property. | from SerializesModels |
| __construct(Dispatcher $events)
Create a new Context instance. | ||
| bool | has(string $key)
Determine if the given key exists. | |
| bool | hasHidden(string $key)
Determine if the given key exists within the hidden context data. | |
| array<string,mixed> | all()
Retrieve all the context data. | |
| array<string,mixed> | allHidden()
Retrieve all the hidden context data. | |
| mixed | get(string $key, mixed $default = null)
Retrieve the given key's value. | |
| mixed | getHidden(string $key, mixed $default = null)
Retrieve the given key's hidden value. | |
| mixed | pull(string $key, mixed $default = null)
Retrieve the given key's value and then forget it. | |
| mixed | pullHidden(string $key, mixed $default = null)
Retrieve the given key's hidden value and then forget it. | |
| array<string,mixed> | only(array<int,string> $keys)
Retrieve only the values of the given keys. | |
| array<string,mixed> | onlyHidden(array<int,string> $keys)
Retrieve only the hidden values of the given keys. | |
| $this | add(string|array<string,mixed> $key, mixed $value = null)
Add a context value. | |
| $this | addHidden(string|array<string,mixed> $key, mixed $value = null)
Add a hidden context value. | |
| $this | forget(string|array<int,string> $key)
Forget the given context key. | |
| $this | forgetHidden(string|array<int,string> $key)
Forget the given hidden context key. | |
| $this | addIf(string $key, mixed $value)
Add a context value if it does not exist yet. | |
| $this | addHiddenIf(string $key, mixed $value)
Add a hidden context value if it does not exist yet. | |
| $this | push(string $key, mixed ...$values)
Push the given values onto the key's stack. | |
| $this | pushHidden(string $key, mixed ...$values)
Push the given hidden values onto the key's stack. | |
| bool | isStackable(string $key)
Determine if a given key can be used as a stack. | |
| bool | isHiddenStackable(string $key)
Determine if a given key can be used as a hidden stack. | |
| bool | isEmpty()
Determine if the repository is empty. | |
| $this | dehydrating(callable $callback)
Execute the given callback when context is about to be dehydrated. | |
| $this | hydrated(callable $callback)
Execute the given callback when context has been hydrated. | |
| Repository | handleUnserializeExceptionsUsing(callable|null $callback)
Handle unserialize exceptions using the given callback. | |
| $this | flush()
Flush all context data. | |
| ?array | dehydrate()
Dehydrate the context data. | |
| $this | hydrate(?array $context)
Hydrate the context instance. |
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Register a custom macro.
Mix another object into the class.
Checks if macro is registered.
Flush the existing macros.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Get the property value prepared for serialization.
Get the restored property value after deserialization.
Restore a queueable collection instance.
Restore the model from the model identifier instance.
Get the query for model restoration.
Prepare the instance values for serialization.
Restore the model after serialization.
Get the property value for the given property.
Create a new Context instance.
Determine if the given key exists.
Determine if the given key exists within the hidden context data.
Retrieve all the context data.
Retrieve all the hidden context data.
Retrieve the given key's value.
Retrieve the given key's hidden value.
Retrieve the given key's value and then forget it.
Retrieve the given key's hidden value and then forget it.
Retrieve only the values of the given keys.
Retrieve only the hidden values of the given keys.
Add a context value.
Add a hidden context value.
Forget the given context key.
Forget the given hidden context key.
Add a context value if it does not exist yet.
Add a hidden context value if it does not exist yet.
Push the given values onto the key's stack.
Push the given hidden values onto the key's stack.
Determine if a given key can be used as a stack.
Determine if a given key can be used as a hidden stack.
Determine if the repository is empty.
Execute the given callback when context is about to be dehydrated.
Execute the given callback when context has been hydrated.
Handle unserialize exceptions using the given callback.
Flush all context data.
| internal |
Dehydrate the context data.
| internal |
Hydrate the context instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Log/Context/Repository.html