本文整理匯總了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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
}
}
示例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);
}