Skip to content

Commit

Permalink
Merge pull request #8 from biiiiiigmonster/fix/whereRelation
Browse files Browse the repository at this point in the history
fix(whereRelation): closure case.
  • Loading branch information
biiiiiigmonster authored Sep 1, 2022
2 parents 082381e + 8938583 commit 1b250fb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Database/Eloquent/BuilderMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
};
}
Expand All @@ -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);
}
});
};
}
Expand Down

0 comments on commit 1b250fb

Please sign in to comment.