trait HasEagerLoading
This is directed at eager loading relationships apart from the request includes.
Properties
| protected array<string| callable> | $loadRelations |
|
||
| protected array<string, callable> | $loadRelationWhere |
|
Methods
Eager load relations when a relation is included in the serialized response.
Allows loading a relationship with additional query modification.
Eager loads relationships before serialization.
The constrained eager loads beneath a relationship the serializer is loading, for `with()` on its query: keyed by the path below it, with their constraints, as compileWhereEagerLoads() gives the top level.
Details
at
line 45
HasEagerLoading
eagerLoad(array|string| Closure $relations)
Eager loads relationships needed for serializer logic.
at
line 61
HasEagerLoading
eagerLoadWhenIncluded(array $includedToRelations)
Eager load relations when a relation is included in the serialized response.
at
line 87
HasEagerLoading
eagerLoadWhere(string $relation, callable $callback)
Allows loading a relationship with additional query modification.
at
line 97
protected void
loadRelations( Collection $models, Context $context, array $included = [])
Eager loads relationships before serialization.
at
line 348
protected array
compileSimpleEagerLoads( Context $context, array $included)
at
line 364
protected array
compileWhereEagerLoads( Context $context)
at
line 374
array
getEagerLoadsFor(string $included, Context $context)
at
line 399
array
getWhereEagerLoadsFor(string $included, Context $context)
The constrained eager loads beneath a relationship the serializer is loading, for `with()` on its query: keyed by the path below it, with their constraints, as compileWhereEagerLoads() gives the top level.