當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Builder::withoutGlobalScope方法代碼示例

本文整理匯總了PHP中Illuminate\Database\Eloquent\Builder::withoutGlobalScope方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::withoutGlobalScope方法的具體用法?PHP Builder::withoutGlobalScope怎麽用?PHP Builder::withoutGlobalScope使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Database\Eloquent\Builder的用法示例。


在下文中一共展示了Builder::withoutGlobalScope方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addOnlyOldVersions

 /**
  * @param Builder $builder
  */
 protected function addOnlyOldVersions(Builder $builder)
 {
     $builder->macro('onlyOldVersions', function (Builder $builder) {
         $model = $builder->getModel();
         $builder->withoutGlobalScope($this)->where($model->getQualifiedIsCurrentVersionColumn(), 0);
         return $builder;
     });
 }
開發者ID:sbarre,項目名稱:eloquent-versioned,代碼行數:11,代碼來源:VersioningScope.php

示例2: addOnlyOffline

 /**
  * Add the only-trashed extension to the builder.
  *
  * @param  \Illuminate\Database\Eloquent\Builder $builder
  * @return void
  */
 protected function addOnlyOffline(Builder $builder)
 {
     $builder->macro('onlyOffline', function (Builder $builder) {
         $model = $builder->getModel();
         $builder->withoutGlobalScope($this)->where($model->getQualifiedStatusColumn(), '=', false);
         return $builder;
     });
 }
開發者ID:SchizoDuckie,項目名稱:Expendable,代碼行數:14,代碼來源:StatusScope.php

示例3: withoutGlobalScope

 /**
  * Remove a registered global scope.
  *
  * @param \Illuminate\Database\Eloquent\Scope|string $scope
  * @return $this 
  * @static 
  */
 public static function withoutGlobalScope($scope)
 {
     return \Illuminate\Database\Eloquent\Builder::withoutGlobalScope($scope);
 }
開發者ID:andybolano,項目名稱:viaja_seguro,代碼行數:11,代碼來源:_ide_helper.php

示例4: extend

 /**
  * Extend the builder.
  * @param Builder $builder
  */
 public function extend(EloquentBuilder $builder)
 {
     $builder->macro('onlyTranslated', function (EloquentBuilder $builder, $locale = null) {
         $builder->getModel()->setOnlyTranslated(true);
         if ($locale) {
             $builder->getModel()->setLocale($locale);
         }
         return $builder;
     });
     $builder->macro('withUntranslated', function (EloquentBuilder $builder) {
         $builder->getModel()->setOnlyTranslated(false);
         return $builder;
     });
     $builder->macro('withFallback', function (EloquentBuilder $builder, $fallbackLocale = null) {
         $builder->getModel()->setWithFallback(true);
         if ($fallbackLocale) {
             $builder->getModel()->setFallbackLocale($fallbackLocale);
         }
         return $builder;
     });
     $builder->macro('withoutFallback', function (EloquentBuilder $builder) {
         $builder->getModel()->setWithFallback(false);
         return $builder;
     });
     $builder->macro('translateInto', function (EloquentBuilder $builder, $locale) {
         if ($locale) {
             $builder->getModel()->setLocale($locale);
         }
         return $builder;
     });
     $builder->macro('withoutTranslations', function (EloquentBuilder $builder) {
         $builder->withoutGlobalScope(static::class);
         return $builder;
     });
     $builder->macro('withAllTranslations', function (EloquentBuilder $builder) {
         $builder->withoutGlobalScope(static::class)->with('translations');
         return $builder;
     });
 }
開發者ID:laraplus,項目名稱:translatable,代碼行數:43,代碼來源:TranslatableScope.php

示例5: addWithoutTranslation

 /**
  * Add the with-trashed extension to the builder.
  *
  * @param  \Illuminate\Database\Eloquent\Builder $builder
  * @return void
  */
 protected function addWithoutTranslation(Builder $builder)
 {
     $builder->macro('withoutTranslation', function (Builder $builder) {
         return $builder->withoutGlobalScope($this);
     });
 }
開發者ID:SchizoDuckie,項目名稱:Expendable,代碼行數:12,代碼來源:TranslatableScope.php

示例6: scopeAllTeams

 /**
  * @param Builder $query
  * @return mixed
  */
 public function scopeAllTeams(Builder $query)
 {
     return $query->withoutGlobalScope('team');
 }
開發者ID:mpociot,項目名稱:teamwork,代碼行數:8,代碼來源:UsedByTeams.php


注:本文中的Illuminate\Database\Eloquent\Builder::withoutGlobalScope方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。