當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。