File tree 2 files changed +10
-8
lines changed
src/Illuminate/Database/Eloquent
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -854,13 +854,9 @@ public function get($columns = ['*'])
854
854
$ models = $ builder ->eagerLoadRelations ($ models );
855
855
}
856
856
857
- $ collection = $ builder ->getModel ()->newCollection ($ models );
858
-
859
- if (Model::isAutomaticallyEagerLoadingRelationships ()) {
860
- $ collection ->withRelationshipAutoloading ();
861
- }
862
-
863
- return $ this ->applyAfterQueryCallbacks ($ collection );
857
+ return $ this ->applyAfterQueryCallbacks (
858
+ $ builder ->getModel ()->newCollection ($ models )
859
+ );
864
860
}
865
861
866
862
/**
Original file line number Diff line number Diff line change @@ -27,7 +27,13 @@ public function newCollection(array $models = [])
27
27
{
28
28
static ::$ resolvedCollectionClasses [static ::class] ??= ($ this ->resolveCollectionFromAttribute () ?? static ::$ collectionClass );
29
29
30
- return new static::$ resolvedCollectionClasses [static ::class]($ models );
30
+ $ collection = new static::$ resolvedCollectionClasses [static ::class]($ models );
31
+
32
+ if (Model::isAutomaticallyEagerLoadingRelationships ()) {
33
+ $ collection ->withRelationshipAutoloading ();
34
+ }
35
+
36
+ return $ collection ;
31
37
}
32
38
33
39
/**
You can’t perform that action at this time.
0 commit comments