当前位置: 首页>>代码示例>>PHP>>正文


PHP Builder::whereNotBetween方法代码示例

本文整理汇总了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;
 }
开发者ID:aginev,项目名称:search-filters,代码行数:14,代码来源:Filter.php

示例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;
             }
         }
     }
 }
开发者ID:LaravelRepository,项目名称:eloquent-repository,代码行数:68,代码来源:EloquentFilter.php

示例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);
 }
开发者ID:KodiComponents,项目名称:module-datasource,代码行数:9,代码来源:NotBetweenOperator.php


注:本文中的Illuminate\Database\Eloquent\Builder::whereNotBetween方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。