This commit is contained in:
2021-03-26 14:55:29 +08:00
parent 745322cc3e
commit a3ebda57ac
+9 -3
View File
@@ -65,11 +65,17 @@ trait QueryTrait
/**
* @param string $column
* @param callable $callable
* @return CaseWhen
* @return $this
*/
public function case(string $column, callable $callable): CaseWhen
public function case(string $column, callable $callable): static
{
return call_user_func($callable, new CaseWhen($column, $this));
$caseWhen = new CaseWhen($column, $this);
call_user_func($callable, $caseWhen);
$this->where[] = $caseWhen->end();
return $this;
}