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 4
4
5
5
use Closure ;
6
6
use Illuminate \Database \Eloquent \Relations \BelongsTo ;
7
+ use Illuminate \Database \Eloquent \Relations \BelongsToMany ;
7
8
use Illuminate \Database \Eloquent \Relations \HasOneOrMany ;
8
9
use Jenssegers \Mongodb \Eloquent \Model ;
9
10
@@ -112,7 +113,11 @@ protected function getRelatedConstraintKey($relation)
112
113
return $ relation ->getForeignKey ();
113
114
}
114
115
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. ' );
116
121
}
117
122
118
123
/**
You can’t perform that action at this time.
0 commit comments