This commit is contained in:
2021-08-10 11:42:44 +08:00
parent c03a93ee98
commit b5e79cd126
+5 -6
View File
@@ -466,7 +466,7 @@ trait QueryTrait
if (!is_array($column)) { if (!is_array($column)) {
$column = explode(',', $column); $column = explode(',', $column);
} }
foreach ($column as $key => $val) { foreach ($column as $val) {
$this->select[] = $val; $this->select[] = $val;
} }
} }
@@ -513,12 +513,11 @@ trait QueryTrait
* @param string $opera * @param string $opera
* @return QueryTrait * @return QueryTrait
*/ */
public function whereAnd(string $columns, string|int|null|bool $value = NULL, string $opera = '='): static public function whereAnd(string $columns, string $opera = '=', string|int|null|bool $value = NULL): static
{ {
if (!is_numeric($value) && !is_bool($value)) { [$columns, $opera, $value] = $this->opera(...func_get_args());
$value = '\'' . $value . '\'';
} $this->where[] = $this->sprintf($columns, $value, $opera);
$this->where[] = $columns . $opera . $value;
return $this; return $this;
} }