Illuminate\Database\Eloquent\Builder::withoutGlobalScope PHP Method

withoutGlobalScope() public method

Remove a registered global scope.
public withoutGlobalScope ( Illuminate\Database\Eloquent\Scope | string $scope )
$scope Illuminate\Database\Eloquent\Scope | string
    public function withoutGlobalScope($scope)
    {
        if (!is_string($scope)) {
            $scope = get_class($scope);
        }
        unset($this->scopes[$scope]);
        $this->removedScopes[] = $scope;
        return $this;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @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;
     });
 }
All Usage Examples Of Illuminate\Database\Eloquent\Builder::withoutGlobalScope