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