当前位置: 首页>>代码示例>>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;未经允许,请勿转载。