diff --git a/src/Database/Eloquent/BuilderMixin.php b/src/Database/Eloquent/BuilderMixin.php index 5a9f986..77d8202 100644 --- a/src/Database/Eloquent/BuilderMixin.php +++ b/src/Database/Eloquent/BuilderMixin.php @@ -325,7 +325,11 @@ public function whereRelationIn(): Closure { return function ($relation, $column, $operator = null, $value = null): Builder { return $this->whereHasIn($relation, function ($query) use ($column, $operator, $value) { - $query->where($column, $operator, $value); + if ($column instanceof Closure) { + $column($query); + } else { + $query->where($column, $operator, $value); + } }); }; } @@ -339,7 +343,11 @@ public function orWhereRelationIn(): Closure { return function ($relation, $column, $operator = null, $value = null): Builder { return $this->orWhereHasIn($relation, function ($query) use ($column, $operator, $value) { - $query->where($column, $operator, $value); + if ($column instanceof Closure) { + $column($query); + } else { + $query->where($column, $operator, $value); + } }); }; }