DependencyInjection
in package
Class DependencyInjection
Handles dependency injection for the application, managing the instantiation and resolution of class dependencies within the container.
Table of Contents
Methods
- resolveModel() : Model
- Resolves and returns an instance of the specified model class.
- resolveParameters() : array<string|int, mixed>
- Resolves and injects parameters for the given callback or closure, using the provided route parameters.
Methods
resolveModel()
Resolves and returns an instance of the specified model class.
public
static resolveModel(string $className[, array<string|int, mixed> $routeParameters = [] ]) : Model
Parameters
- $className : string
-
The fully qualified class name of the model to resolve.
- $routeParameters : array<string|int, mixed> = []
-
Optional route parameters to be passed to the model constructor or resolver.
Return values
Model —The resolved model instance.
resolveParameters()
Resolves and injects parameters for the given callback or closure, using the provided route parameters.
public
static resolveParameters(Closure|array<string|int, mixed> $callback[, array<string|int, mixed> $routeParameters = [] ]) : array<string|int, mixed>
Parameters
- $callback : Closure|array<string|int, mixed>
-
The callback or closure whose parameters need to be resolved.
- $routeParameters : array<string|int, mixed> = []
-
Optional. An associative array of parameters to be injected into the callback.
Return values
array<string|int, mixed> —The resolved parameters ready to be passed to the callback.