本文整理汇总了PHP中Illuminate\Database\Eloquent\Builder::whereNotBetween方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::whereNotBetween方法的具体用法?PHP Builder::whereNotBetween怎么用?PHP Builder::whereNotBetween使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Builder
的用法示例。
在下文中一共展示了Builder::whereNotBetween方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setNotBetween
/**
* NotBetween
*
* @param $key
* @param $value
* @return $this
*/
private function setNotBetween($key, $value)
{
if (is_array($value)) {
$this->query->whereNotBetween($key, $value);
}
return $this;
}
示例2: apply
/**
* @param Builder $where
* @param array $filters
* @param string $boolean
*/
protected static function apply(Builder $where, array $filters, $boolean)
{
foreach ($filters as $filterName => $valuePair) {
foreach ($valuePair as $key => $value) {
if (is_array($value) && count($value) > 0) {
$value = array_values($value);
if (count($value[0]) > 1) {
switch ($filterName) {
case BaseFilter::RANGES:
$where->whereBetween($key, [$value[0][0], $value[0][1]], $boolean);
break;
case BaseFilter::NOT_RANGES:
$where->whereNotBetween($key, [$value[0][0], $value[0][1]], $boolean);
break;
}
} else {
switch ($filterName) {
case BaseFilter::GROUP:
$where->whereIn($key, $value, $boolean);
break;
case BaseFilter::NOT_GROUP:
$where->whereNotIn($key, $value, $boolean);
break;
}
}
}
$value = (array) $value;
$value = array_shift($value);
switch ($filterName) {
case BaseFilter::GREATER_THAN_OR_EQUAL:
$where->where($key, '>=', $value, $boolean);
break;
case BaseFilter::GREATER_THAN:
$where->where($key, '>', $value, $boolean);
break;
case BaseFilter::LESS_THAN_OR_EQUAL:
$where->where($key, '<=', $value, $boolean);
break;
case BaseFilter::LESS_THAN:
$where->where($key, '<', $value, $boolean);
break;
case BaseFilter::CONTAINS:
$where->where($key, 'LIKE', '%' . $value . '%', $boolean);
break;
case BaseFilter::NOT_CONTAINS:
$where->where($key, 'NOT LIKE', '%' . $value . '%', $boolean);
break;
case BaseFilter::STARTS_WITH:
$where->where($key, 'LIKE', $value . '%', $boolean);
break;
case BaseFilter::ENDS_WITH:
$where->where($key, 'LIKE', '%' . $value, $boolean);
break;
case BaseFilter::EQUALS:
$where->where($key, '=', $value, $boolean);
break;
case BaseFilter::NOT_EQUAL:
$where->where($key, '!=', $value, $boolean);
break;
}
}
}
}
示例3: _query
/**
* @param Builder $query
* @param string $field
* @param string $condition
*/
protected function _query(Builder $query, $field, $condition = 'and')
{
$query->whereNotBetween($field, $this->getValue(), $condition);
}