File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/Jenssegers/Mongodb/Helpers Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 44
55use Closure ;
66use Illuminate \Database \Eloquent \Relations \BelongsTo ;
7+ use Illuminate \Database \Eloquent \Relations \BelongsToMany ;
78use Illuminate \Database \Eloquent \Relations \HasOneOrMany ;
89use Jenssegers \Mongodb \Eloquent \Model ;
910
@@ -112,7 +113,11 @@ protected function getRelatedConstraintKey($relation)
112113 return $ relation ->getForeignKey ();
113114 }
114115
115- throw new \Exception (class_basename ($ relation ) . ' Is Not supported for hybrid query constraints! ' );
116+ if ($ relation instanceof BelongsToMany && ! $ this ->isAcrossConnections ($ relation )) {
117+ return $ this ->model ->getKeyName ();
118+ }
119+
120+ throw new \Exception (class_basename ($ relation ) . ' is not supported for hybrid query constraints. ' );
116121 }
117122
118123 /**
You can’t perform that action at this time.
0 commit comments