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


PHP Builder::whereNotExists方法代码示例

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


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

示例1: find

 /**
  * @param User $actor
  * @param Builder $query
  */
 public function find(User $actor, Builder $query)
 {
     // Hide discussions which have tags that the user is not allowed to see.
     $query->whereNotExists(function ($query) use($actor) {
         return $query->select(new Expression(1))->from('discussions_tags')->whereIn('tag_id', Tag::getIdsWhereCannot($actor, 'viewDiscussions'))->where('discussions.id', new Expression('discussion_id'));
     });
 }
开发者ID:lazyboywu,项目名称:edufunbbs,代码行数:11,代码来源:DiscussionPolicy.php

示例2: scopeExceptGeneral

 /**
  * 扩展查询,获取排除通识素质课的课程数据
  * @author FuRongxin
  * @date    2016-03-09
  * @version 2.0
  * @param   \Illuminate\Database\Eloquent\Builder $query 查询对象
  * @return  \Illuminate\Database\Eloquent\Builder 查询对象
  */
 public function scopeExceptGeneral($query)
 {
     return $query->whereNotExists(function ($query) {
         $query->from('pk_kczy AS a')->whereRaw('t_a.nd = t_pk_kczy.nd AND t_a.xq = t_pk_kczy.xq AND t_a.zsjj = t_pk_kczy.zsjj AND t_a.kcxh = t_pk_kczy.kcxh')->wherePt('T')->where(function ($query) {
             $query->whereXz('W')->orWhere('xz', '=', 'I')->orWhere('xz', '=', 'Y')->orWhere('xz', '=', 'Q');
         });
     });
 }
开发者ID:rxfu,项目名称:student,代码行数:16,代码来源:Mjcourse.php

示例3: find

 /**
  * @param User $actor
  * @param Builder $query
  */
 public function find(User $actor, Builder $query)
 {
     // Hide discussions which have tags that the user is not allowed to see.
     $query->whereNotExists(function ($query) use($actor) {
         return $query->select(new Expression(1))->from('discussions_tags')->whereIn('tag_id', Tag::getIdsWhereCannot($actor, 'viewDiscussions'))->where('discussions.id', new Expression('discussion_id'));
     });
     // Hide discussions with no tags if the user doesn't have that global
     // permission.
     if (!$actor->hasPermission('viewDiscussions')) {
         $query->has('tags');
     }
 }
开发者ID:jwdeitch,项目名称:flarum-ext-tags,代码行数:16,代码来源:DiscussionPolicy.php


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