當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Builder::whereNotNull方法代碼示例

本文整理匯總了PHP中Illuminate\Database\Query\Builder::whereNotNull方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::whereNotNull方法的具體用法?PHP Builder::whereNotNull怎麽用?PHP Builder::whereNotNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Database\Query\Builder的用法示例。


在下文中一共展示了Builder::whereNotNull方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addWhere

 /**
  * Add a "where" clause to the given query.
  *
  * @param  \Illuminate\Database\Query\Builder $query
  * @param  string $key
  * @param  string $extraValue
  * @return void
  */
 protected function addWhere($query, $key, $extraValue)
 {
     if ($extraValue === 'NULL') {
         $query->whereNull($key);
     } elseif ($extraValue === 'NOT_NULL') {
         $query->whereNotNull($key);
     } else {
         $query->where($key, $extraValue);
     }
 }
開發者ID:scrobot,項目名稱:Lumen,代碼行數:18,代碼來源:DatabasePresenceVerifier.php

示例2: addWhere

 /**
  * Add a "where" clause to the given query.
  *
  * @param \Illuminate\Database\Query\Builder $query        	
  * @param string $key        	
  * @param string $extraValue        	
  * @return void
  */
 protected function addWhere($query, $key, $extraValue)
 {
     if ($extraValue === 'NULL') {
         $query->whereNull($key);
     } elseif ($extraValue === 'NOT_NULL') {
         $query->whereNotNull($key);
     } elseif (Str::startsWith($extraValue, '!')) {
         $query->where($key, '!=', mb_substr($extraValue, 1));
     } else {
         $query->where($key, $extraValue);
     }
 }
開發者ID:sapwoo,項目名稱:portfolio,代碼行數:20,代碼來源:DatabasePresenceVerifier.php

示例3: _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 '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;
 }
開發者ID:kyleing,項目名稱:laravel-tool,代碼行數:52,代碼來源:DBOperator.php

示例4: whereNotNull

 /**
  * Add a "where not null" clause to the query.
  *
  * @param string $column
  * @param string $boolean
  * @return \Illuminate\Database\Query\Builder|static 
  * @static 
  */
 public static function whereNotNull($column, $boolean = 'and')
 {
     return \Illuminate\Database\Query\Builder::whereNotNull($column, $boolean);
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:12,代碼來源:_ide_helper.php

示例5: onlyTrashed

 /**
  * Force the result set to only included soft deletes.
  *
  * @return \Illuminate\Database\Eloquent\Builder|static
  */
 public function onlyTrashed()
 {
     $this->withTrashed();
     $this->query->whereNotNull($this->model->getQualifiedDeletedAtColumn());
     return $this;
 }
開發者ID:aysenli,項目名稱:laravel-admin-1,代碼行數:11,代碼來源:Builder.php

示例6: addWhereQuery

 /**
  * Add where to query builder
  * @param \Illuminate\Database\Query\Builder $query
  * @param array $subentity = null only add wheres with this subeneity
  */
 protected function addWhereQuery($query, $subentity = null)
 {
     // Ex with both filter and where: select * from `dms` where (`key` like ? or `name` like ?) and `disabled` = ?
     if (isset($this->where)) {
         foreach ($this->where as $where) {
             #$table = $where['table'];
             $column = $where['column'];
             $operator = $where['operator'];
             $value = $where['value'];
             if ($operator == 'in') {
                 #$query->whereIn("$table.$column", $value);
                 $query->whereIn($column, $value);
             } elseif ($operator == 'null') {
                 if ($value) {
                     $query->whereNull($column);
                 } else {
                     $query->whereNotNull($column);
                 }
             } else {
                 #$query->where("$table.$column", $operator, $value);
                 $query->where($column, $operator, $value);
             }
         }
     }
 }
開發者ID:mreschke,項目名稱:repository,代碼行數:30,代碼來源:DbStore.php

示例7: scopeOnlyPublished

 /**
  * Query scope for only published data.
  *
  * @param \Illuminate\Database\Query\Builder $query
  *
  * @return \Illuminate\Database\Query\Builder
  */
 public function scopeOnlyPublished($query)
 {
     return $query->whereNotNull(self::PUBLISHED_AT);
 }
開發者ID:aguaragazu,項目名稱:LaravelStart,代碼行數:11,代碼來源:Publishable.php


注:本文中的Illuminate\Database\Query\Builder::whereNotNull方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。