Closed
Description
When opne object of a model is retrieved with a relationship, eager loading works fine.
However when multiple objects are retrieved the relationship collection is set, but empty.
$location = Location::with('inhabitants')->find('winterfell');
vs
$locations = Location::with('inhabitants')->get();
#relations: array:1 [
"inhabitants" => Illuminate\Database\Eloquent\Collection {#2940 ▼
#items: []
#escapeWhenCastingToString: false
}
]
This happens with a HasMany relationship, but not BelongsTo. Other relationships need to be checked.
Metadata
Metadata
Assignees
Labels
No labels