core
core copied to clipboard
Use correct parent model for `hasOne` relationships
When eager-loading hasOne relationships on a collection of parent models, it always uses the last parent assigned to $model further up in the method call.
This is fixed by using $value inside the loop where the relationship is loaded.