本文整理匯總了PHP中Illuminate\Database\Query\Builder::whereBetween方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::whereBetween方法的具體用法?PHP Builder::whereBetween怎麽用?PHP Builder::whereBetween使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Query\Builder
的用法示例。
在下文中一共展示了Builder::whereBetween方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: whereBetween
/**
* between, 兩端開區間
* @param $attribute
* @param null $min
* @param null $max
* @return static
*/
public function whereBetween($attribute, $min, $max)
{
if ($min > $max) {
return $this->whereEquals(0, 1);
}
$this->original->whereBetween($attribute, [$min, $max]);
return $this;
}
示例2: _wheres
/**
* 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 'between':
$this->operator->whereBetween($field, $val);
break;
case 'raw':
$this->operator->whereRaw($val);
break;
default:
$this->operator->where($field, $op, $val);
}
}
return $this;
}
示例3: whereBetween
/**
* Add a where between statement to the query.
*
* @param string $column
* @param array $values
* @param string $boolean
* @param bool $not
* @return $this
* @static
*/
public static function whereBetween($column, $values, $boolean = 'and', $not = false)
{
return \Illuminate\Database\Query\Builder::whereBetween($column, $values, $boolean, $not);
}
示例4: whereBetween
public function whereBetween($column, array $values, $boolean = 'and', $not = false)
{
$column = is_string($column) ? snake_case($column) : $column;
return parent::whereBetween($column, $values, $boolean, $not);
// TODO: Change the autogenerated stub
}