diff --git a/src/Orm/Relations/ManyToMany/index.ts b/src/Orm/Relations/ManyToMany/index.ts index 1a5fc868..ef2e9d35 100644 --- a/src/Orm/Relations/ManyToMany/index.ts +++ b/src/Orm/Relations/ManyToMany/index.ts @@ -232,7 +232,7 @@ export class ManyToMany implements ManyToManyRelationContract { this._addSelect(query) this._addJoin(query) - return query.where(`${this.pivotTable}.${this.pivotForeignKey}`, value) + return query.wherePivot(this.pivotForeignKey, value) } /** @@ -248,7 +248,7 @@ export class ManyToMany implements ManyToManyRelationContract { this._addSelect(query) this._addJoin(query) - return query.whereIn(`${this.pivotTable}.${this.pivotForeignKey}`, values) + return query.whereInPivot(this.pivotForeignKey, values) } /**