This commit is contained in:
2021-03-26 19:09:54 +08:00
parent 11ef881927
commit 78cf1b2a9a
2 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -23,8 +23,9 @@ class InCondition extends Condition
{
if (is_array($this->value)) {
return sprintf('%s IN (%s)', $this->column, implode(',', $this->value));
} else {
return sprintf('%s IN (%s)', $this->column, $this->value);
}
return '';
}
}
+4 -1
View File
@@ -702,7 +702,10 @@ trait QueryTrait
*/
public function in($columns, $value): static
{
if (empty($value) || !is_array($value)) {
if ($value instanceof Closure) {
$value = $this->makeClosureFunction($value);
}
if (empty($value)) {
$value = [-1];
}
$this->where[] = ['IN', $columns, $value];