File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,17 @@ protected function getResultsByType($type)
29
29
30
30
$ key = $ instance ->getKeyName ();
31
31
32
- $ query = $ instance ->newQuery ();
32
+ // Copied this block from the parent method, based on the bug report at
33
+ // https://github.com/mongodb/laravel-mongodb/issues/1361
34
+ $ query = $ this ->replayMacros ($ instance ->newQuery ())
35
+ ->mergeConstraintsFrom ($ this ->getQuery ())
36
+ ->with (array_merge (
37
+ $ this ->getQuery ()->getEagerLoads (),
38
+ (array ) ($ this ->morphableEagerLoads [get_class ($ instance )] ?? [])
39
+ ))
40
+ ->withCount (
41
+ (array ) ($ this ->morphableEagerLoadCounts [get_class ($ instance )] ?? [])
42
+ );
33
43
34
44
return $ query ->whereIn ($ key , $ this ->gatherKeysByType ($ type , $ instance ->getKeyType ()))->get ();
35
45
}
You can’t perform that action at this time.
0 commit comments