Skip to content

Commit c0519cf

Browse files
committed
Reaffirm support for BelongsToMany relations
This temporarily skirts around the issue described in the following issue: mongodb/laravel-mongodb#1293
1 parent e93daba commit c0519cf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Jenssegers/Mongodb/Helpers/QueriesRelationships.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ protected function getRelatedConstraintKey($relation)
112112
return $relation->getForeignKey();
113113
}
114114

115-
throw new \Exception(class_basename($relation) . ' Is Not supported for hybrid query constraints!');
115+
if ($relation instanceof BelongsToMany && ! $this->isAcrossConnections($relation)) {
116+
return $this->model->getKeyName();
117+
}
118+
119+
throw new \Exception(class_basename($relation) . ' is not supported for hybrid query constraints.');
116120
}
117121

118122
/**

0 commit comments

Comments
 (0)