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


PHP Builder::whereNull方法代码示例

本文整理汇总了PHP中Illuminate\Database\Eloquent\Builder::whereNull方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::whereNull方法的具体用法?PHP Builder::whereNull怎么用?PHP Builder::whereNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Eloquent\Builder的用法示例。


在下文中一共展示了Builder::whereNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: apply

 /**
  * Applies parameter filtering for a given query
  *
  * @param string          $name
  * @param mixed           $value
  * @param EloquentBuilder $query
  * @param FilterInterface $filter
  * @return EloquentBuilder
  */
 public function apply($name, $value, $query, FilterInterface $filter)
 {
     $column = (!empty($this->table) ? $this->table . '.' : null) . (!empty($this->column) ? $this->column : $name);
     return $query->where(function ($query) use($column) {
         return $query->whereNull($column)->orWhere($column, '');
     });
 }
开发者ID:czim,项目名称:laravel-filter,代码行数:16,代码来源:Empty.php

示例2: execute

 public function execute(Builder $query)
 {
     if ($this->group) {
         return $query->where('group', '=', $this->group);
     } else {
         return $query->whereNull('group');
     }
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:8,代码来源:Group.php

示例3: build

 public function build(Builder $query)
 {
     if ($this->parentId) {
         return $query->where('parent_id', '=', $this->parentId);
     } else {
         return $query->whereNull('parent_id');
     }
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:8,代码来源:ParentId.php

示例4: build

 /**
  * @param Builder $query
  *
  * @return Builder
  */
 public function build(Builder $query)
 {
     if ($this->page === null) {
         return $query->whereNull('parent_id');
     }
     list($col, $direction) = $this->page->getChildOrderingPolicy();
     return $query->where('parent_id', '=', $this->page->getId())->orderBy($col, $direction);
 }
开发者ID:boomcms,项目名称:boom-core,代码行数:13,代码来源:ParentPage.php

示例5: find

 /**
  * @param User $actor
  * @param Builder $query
  */
 public function find(User $actor, Builder $query)
 {
     if (!$actor->hasPermission('discussion.hide')) {
         $query->where(function ($query) use($actor) {
             $query->whereNull('discussions.hide_time')->where('comments_count', '>', 0)->orWhere('start_user_id', $actor->id);
             $this->events->fire(new ScopeHiddenDiscussionVisibility($query, $actor, 'discussion.hide'));
         });
     }
 }
开发者ID:johnulist,项目名称:core,代码行数:13,代码来源:DiscussionPolicy.php

示例6: newQuery

 /**
  * Overriding newQuery() to the custom PostBuilder with some intereting methods
  * 
  * @param bool $excludeDeleted
  * @return Corcel\PostBuilder
  */
 public function newQuery($excludeDeleted = true)
 {
     $builder = new Builder($this->newBaseQueryBuilder());
     $builder->setModel($this);
     $builder->leftJoin('wp_term_taxonomy', 'wp_terms.term_id', '=', 'wp_term_taxonomy.term_id')->where('wp_term_taxonomy.taxonomy', '=', 'category')->select('wp_terms.*');
     if ($excludeDeleted and $this->softDelete) {
         $builder->whereNull($this->getQualifiedDeletedAtColumn());
     }
     return $builder;
 }
开发者ID:rajivseelam,项目名称:corcel,代码行数:16,代码来源:Category.php

示例7: scopeForModel

 /**
  * Constrain a query to an ability for a specific model.
  *
  * @param  \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder  $query
  * @param  \Illuminate\Database\Eloquent\Model  $model
  * @return void
  */
 public function scopeForModel($query, Model $model)
 {
     $query->where(function ($query) use($model) {
         $query->where('entity_type', $model->getMorphClass());
         $query->where(function ($query) use($model) {
             $query->whereNull('entity_id');
             if ($model->exists) {
                 $query->orWhere('entity_id', $model->getKey());
             }
         });
     });
 }
开发者ID:Gummibeer,项目名称:bouncer,代码行数:19,代码来源:Ability.php

示例8: scopeTaggedWith

 /**
  * @param Builder $builder
  * @param Collection $tags
  * @return Builder
  */
 public function scopeTaggedWith(Builder $builder, Collection $tags)
 {
     /** @var MorphToMany $relation */
     $relation = $this->tags();
     $key = $this->getTable() . '.' . $this->getKeyName();
     if ($tags->count()) {
         $builder->join($relation->getTable(), function ($join) use($relation, $key, $tags) {
             $join->on($relation->getForeignKey(), '=', $key);
             $join->where($relation->getMorphType(), '=', $relation->getMorphClass());
             $join->whereIn($relation->getOtherKey(), $tags->keys()->toArray());
         });
     } else {
         $builder->whereNull($this->getTable());
     }
     return $builder;
 }
开发者ID:jaffle-be,项目名称:framework,代码行数:21,代码来源:Taggable.php

示例9: apply

 /**
  * Aplicar.
  *
  * @param Builder $builder
  * @param Model $model
  */
 public function apply(Builder $builder, Model $model)
 {
     // Verificar se deve filtrar o inquilino
     if (isset($model->multTenant) && $model->multTenant == true) {
         // Verificar se esta logado
         if (is_null(\Auth::id())) {
             return;
         }
         // Verificar qual o inquilino informado
         $inquilino_id = \Auth::user()->{Table::tenantField()};
         if (is_null($inquilino_id)) {
             $builder->whereNull(Table::tenantField());
         } else {
             $builder->where(Table::tenantField(), $inquilino_id);
         }
     }
 }
开发者ID:bugotech,项目名称:database,代码行数:23,代码来源:TenantScope.php

示例10: scopeNotScheduled

 /**
  * Finds all non-scheduled incidents.
  *
  * @param \Illuminate\Database\Eloquent\Builder $query
  *
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeNotScheduled(Builder $query)
 {
     return $query->where('status', '>', 0)->orWhere(function ($query) {
         $query->where('status', 0)->where(function ($query) {
             $query->whereNull('scheduled_at')->orWhere('scheduled_at', '<=', Carbon::now()->toDateTimeString());
         });
     });
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:15,代码来源:Incident.php

示例11: scopeForModel

 /**
  * Constrain a query to an permission for a specific model.
  *
  * @param  \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder  $query
  * @param  \Illuminate\Database\Eloquent\Model|string  $model
  * @param  bool  $strict
  * @return void
  */
 public function scopeForModel($query, $model, $strict = false)
 {
     $model = is_string($model) ? new $model() : $model;
     $query->where(function ($query) use($model, $strict) {
         $query->where('entity_type', $model->getMorphClass());
         $query->where(function ($query) use($model, $strict) {
             // If the model does not exist, we want to search for blanket permissions
             // that cover all instances of this model. If it does exist, we only
             // want to find blanket permissions if we're not using strict mode.
             if (!$model->exists || !$strict) {
                 $query->whereNull('entity_id');
             }
             if ($model->exists) {
                 $query->orWhere('entity_id', $model->getKey());
             }
         });
     });
 }
开发者ID:devonzara,项目名称:bouncer,代码行数:26,代码来源:Permission.php

示例12: scopeGuests

 /**
  * Returns all the guest users.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $query
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeGuests(Builder $query)
 {
     return $query->whereNull('user_id');
 }
开发者ID:umahatokula,项目名称:academia,代码行数:10,代码来源:Session.php

示例13: generateNullConditionFromHasOneOrMany

 private function generateNullConditionFromHasOneOrMany(HasOneOrMany $relation)
 {
     $this->query = $this->query->whereNull($relation->getForeignKey());
 }
开发者ID:brazenvoid,项目名称:better-eloquent,代码行数:4,代码来源:JoinBuilder.php

示例14: scopeParents

 public function scopeParents(Builder $builder)
 {
     $builder->whereNull('parent_id');
 }
开发者ID:cipemotion,项目名称:medialibrary,代码行数:4,代码来源:Category.php

示例15: whereNull

 /**
  * Add a whereNull to the query
  *
  * @param $field
  * @return mixed
  */
 public function whereNull($field)
 {
     $this->builder = $this->builder->whereNull($field);
     return $this;
 }
开发者ID:kodebyraaet,项目名称:pattern,代码行数:11,代码来源:BaseRepository.php


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