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)
2929
3030 $ key = $ instance ->getKeyName ();
3131
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+ );
3343
3444 return $ query ->whereIn ($ key , $ this ->gatherKeysByType ($ type , $ instance ->getKeyType ()))->get ();
3545 }
You can’t perform that action at this time.
0 commit comments