We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9e4786c + 6d4888a commit 9df75b7Copy full SHA for 9df75b7
src/Jenssegers/Mongodb/Helpers/QueriesRelationships.php
@@ -4,6 +4,7 @@
4
5
use Closure;
6
use Illuminate\Database\Eloquent\Relations\BelongsTo;
7
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
8
use Illuminate\Database\Eloquent\Relations\HasOneOrMany;
9
use Jenssegers\Mongodb\Eloquent\Model;
10
@@ -112,7 +113,11 @@ protected function getRelatedConstraintKey($relation)
112
113
return $relation->getForeignKey();
114
}
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.');
121
122
123
/**
0 commit comments