本文整理汇总了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
}