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


PHP Builder::orWhereHas方法代码示例

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


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

示例1: constrainUsers

 /**
  * Constrain the given users query by the provided permission.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $query
  * @param  string  $permission
  * @param  \Illuminate\Database\Eloquent\Model|string|null  $model
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function constrainUsers($query, $permission, $model = null)
 {
     return $query->where(function ($query) use($permission, $model) {
         $query->whereHas('permissions', $this->getPermissionConstraint($permission, $model));
         $query->orWhereHas('roles', $this->getRoleConstraint($permission, $model));
     });
 }
开发者ID:devonzara,项目名称:bouncer,代码行数:15,代码来源:Permissions.php

示例2: constrainUsers

 /**
  * Constrain the given users query by the provided ability.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $query
  * @param  string  $ability
  * @param  \Illuminate\Database\Eloquent\Model|string|null  $model
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function constrainUsers($query, $ability, $model = null)
 {
     return $query->where(function ($query) use($ability, $model) {
         $query->whereHas('abilities', $this->getAbilityConstraint($ability, $model));
         $query->orWhereHas('roles', $this->getRoleConstraint($ability, $model));
     });
 }
开发者ID:marcusmoore,项目名称:bouncer,代码行数:15,代码来源:Abilities.php

示例3: orWhereHas

 /**
  * Add a relationship count condition to the query with where clauses and an "or".
  *
  * @param string $relation
  * @param \Closure $callback
  * @param string $operator
  * @param int $count
  * @return \Illuminate\Database\Eloquent\Builder|static 
  * @static 
  */
 public static function orWhereHas($relation, $callback, $operator = '>=', $count = 1)
 {
     return \Illuminate\Database\Eloquent\Builder::orWhereHas($relation, $callback, $operator, $count);
 }
开发者ID:satriashp,项目名称:tour,代码行数:14,代码来源:_ide_helper.php

示例4: buildWildcardQueryFilters

 /**
  * Build wildcard query filters.
  *
  * @param  \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder  $query
  * @param  array  $fields
  * @param  array  $keyword
  * @param  string  $group
  *
  * @return void
  */
 protected function buildWildcardQueryFilters($query, array $fields, array $keyword = [])
 {
     foreach ($fields as $field) {
         if (Str::contains($field, '.') && $query instanceof Builder) {
             list($relation, $field) = explode('.', $field, 2);
             $query->orWhereHas($relation, function ($query) use($field, $keyword) {
                 $this->buildWildcardQueryFilterWithKeyword($query, $field, $keyword, 'where');
             });
         } else {
             $this->buildWildcardQueryFilterWithKeyword($query, $field, $keyword, 'orWhere');
         }
     }
 }
开发者ID:DavidIWilson,项目名称:site1,代码行数:23,代码来源:QueryFilterTrait.php


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