/**
* like wheres function ,call by internal
* @param array $conds
* @return $this
*/
protected function _wheres($conds)
{
foreach ($conds as $field => $opAndVal) {
if (is_null($opAndVal)) {
$opAndVal = [null];
}
$opAndVal = (array) $opAndVal;
$op = strtolower(count($opAndVal) == 1 ? '=' : $opAndVal[0]);
$val = last($opAndVal);
$field = str_contains($field, '.') ? $field : $this->_table . '.' . $field;
switch ($op) {
case 'in':
if (count($val) == 1) {
$this->_operator->where($field, '=', $val[0]);
} else {
$this->_operator->whereIn($field, $val);
}
break;
case 'notin':
if (count($val) == 1) {
$this->_operator->where($field, '<>', $val[0]);
} else {
$this->_operator->whereNotIn($field, $val);
}
break;
case 'between':
$this->_operator->whereBetween($field, $val);
break;
case 'notbetween':
$this->_operator->whereNotBetween($field, $val);
break;
case 'null':
if ($val) {
$this->_operator->whereNull($field);
} else {
$this->_operator->whereNotNull($field);
}
break;
case 'raw':
$this->_operator->whereRaw($val);
break;
default:
$this->_operator->where($field, $op, $val);
}
}
return $this;
}