Apply the scope to a given ORM query builder.

@param  \Nova\Database\ORM\Builder  $builder
@return void
339242
public function apply(Builder $builder)
    {
        $model = $builder->getModel();

        $builder->whereNull($model->getQualifiedDeletedAtColumn());

        $this->extend($builder);
    }
746595
public function apply(Builder $builder, Model $model): void
    {
        $builder->orderBy(self::NAME_ATTRIBUTE);
    }
821728
public function apply(Builder $builder, Model $model)
    {
        if (!UserUtils::hasDisplayAllStatus())
        {
            $builder->where($model->getQualifiedStatusColumn(), true);
        }
        $this->extend($builder);

    }
446304
public function apply($builder)
    {
        $values = $this->getValues();
        if (empty($values)) {
            return $builder;
        }

        return $builder->whereHas('component', function($query) use($values) {
                    $query->whereIn('id', $values);
                });
    }
1290502
public function apply(Builder $builder)
    {
        $sortMethod = 'sort' . studly_case($this->getField());

        if(method_exists($builder->getModel(), $sortMethod)) {
            call_user_func_array([$builder->getModel(), $sortMethod], [$builder, $this->getOrder()]);
        } else {
            $builder->orderBy($this->getField(), $this->getOrder());
        }
    }
522796
public function scopeOfUpdater(Builder $builder, Model $user): Builder
    {
        return $builder->where('updated_by_type', $user->getMorphClass())->where('updated_by_id', $user->getKey());
    }
1120169
public function apply(Builder $builder, Model $model): void
    {
        if (method_exists($model, 'shouldApplyEndedAtScope') && $model->shouldApplyEndedAtScope()) {
            $builder->whereNull('ended_at');
        }
    }
459910
def _apply_scope(self, scope, builder):
        
        if callable(scope):
            scope(builder)
        elif isinstance(scope, Scope):
            scope.apply(builder, self.get_model())
323042
public function handleBuilder($builder, $value)
    {
        // Allow users to overwrite the default "where" clause, e.g. "whereYear"
        $clause = $this->directiveArgValue('clause', 'where');

        return $builder->{$clause}(
            $this->directiveArgValue('key', $this->definitionNode->name->value),
            $operator = $this->directiveArgValue('operator', '='),
            $value
        );
    }
291033
public function extend(Builder $builder): void
    {
        foreach ($this->extensions as $extension) {
            $this->{"add{$extension}"}($builder);
        }
    }
599211
protected function addAccept(Builder $builder): void
    {
        $builder->macro('accept', function (Builder $builder) {
            $builder->withNotAccepted();

            return $builder->update(['is_accepted' => 1]);
        });
    }
357686
public function remove(Builder $builder, Model $model)
    {
        $query = $builder->getQuery();

        if (is_null($query->wheres)) {
            return;
        }

        $bindingKey = 0;

        $scopeConstraints = $this->getScopeConstraints($model);

        foreach ((array) $query->wheres as $key => $where) {
            $bindingsCount = $this->countBindings($where);

            if (in_array($where, $scopeConstraints)) {
                $this->removeWhere($query, $key);

                $this->removeBindings($query, $bindingKey, $bindingsCount);
            } else {
                $bindingKey += $bindingsCount;
            }
        }

        $query->wheres = array_values($query->wheres);
    }
183307
public function applyScopes()
	{
		if ( !$this->scopes )
		{
			return $this;
		}

		$builder = clone $this;

		foreach ( $this->scopes as $scope )
		{
			$builder->callScope( function ( Builder $builder ) use ( $scope )
			{
				if ( $scope instanceof Closure )
				{
					$scope( $builder );
				}
				elseif ( $scope instanceof Scope )
				{
					$scope->apply( $builder, $this->getModel() );
				}
			} );
		}

		return $builder;
	}
850787
public function apply(Builder $query, Model $model)
    {
        Models::scope()->applyToModelQuery($query, $model->getTable());
    }
1349579
protected function applyScopes(QueryBuilder $query, Model $model, $ignoreScopes = [])
    {
        // Verificar se deve ignorar todos os scopes
        if (in_array('*', $ignoreScopes)) {
            return;
        }

        // Carregar lista de scopes
        $class = get_called_class();
        $scopes = Arr::get(static::$scopes, $class, []);

        // Aplicar scopes
        foreach ($scopes as $sid => $scope) {
            // Verificar se deve ignorar scope especifico
            if (! in_array($sid, $ignoreScopes)) {
                $scope->apply($query, $model);
            }
        }
    }
118555
public function applyScopes()
    {
        if (! $this->scopes) {
            return $this;
        }

        $builder = $this;

        foreach ($builder->scopes as $identifier => $scope) {
            if (! isset($builder->scopes[$identifier])) {
                continue;
            }

            $builder->callScope(function (DynamoDbQueryBuilder $builder) use ($scope) {
                // If the scope is a Closure we will just go ahead and call the scope with the
                // builder instance. The "callScope" method will properly group the clauses
                // that are added to this query so "where" clauses maintain proper logic.
                if ($scope instanceof Closure) {
                    $scope($builder);
                }

                // If the scope is a scope object, we will call the apply method on this scope
                // passing in the builder and the model instance. After we run all of these
                // scopes we will return back the builder instance to the outside caller.
                if ($scope instanceof Scope) {
                    throw new NotSupportedException('Scope object is not yet supported');
                }
            });

            $builder->withoutGlobalScope($identifier);
        }

        return $builder;
    }
428991
public function scopeFiltersApply(Builder $query, $entity = null): Builder
    {
        if (! is_null($entity)) {
            try {
                $this->getEntity($entity);
            } catch (EntityTypeException $e) {
            }
        }

        return $this->filter($query);
    }