public function apply($query, $target, $value, $parameters = [])
    {
        $this->model      = $query->getModel();
        $this->parameters = $parameters;

        $targets = $this->parseTargets($target);

        // If there is only a single target, do not group the condition.
        if (count($targets) == 1) {

            $this->applyForSingleTarget($query, head($targets), $value, true);

            return;
        }

        // If we combine with the 'or' operator, group the filter's conditions
        // so the relation with the other filters is kept inclusive.

        $query->where(function ($query) use ($targets, $value) {

            $this->combineOr = true;

            foreach ($targets as $index => $singleTarget) {

                $this->applyForSingleTarget($query, $singleTarget, $value, $index < 1);
            }
        });
    }
public function apply($query, $target, $value, $parameters = [])
    {
        $this->model      = $query->getModel();
        $this->parameters = $parameters;

        $targets = $this->parseTargets($target);

        // If there is only a single target, do not group the condition.
        if (count($targets) == 1) {

            $this->applyForSingleTarget($query, head($targets), $value, true);

            return;
        }

        // If we combine with the 'or' operator, group the filter's conditions
        // so the relation with the other filters is kept inclusive.

        $query->where(function ($query) use ($targets, $value) {

            $this->combineOr = true;

            foreach ($targets as $index => $singleTarget) {

                $this->applyForSingleTarget($query, $singleTarget, $value, $index < 1);
            }
        });
    }
public function apply ( $ query , $ target , $ value , $ parameters = [ ] ) { $ this -> model = $ query -> getModel ( ) ; $ this -> parameters = $ parameters ; $ targets = $ this -> parseTargets ( $ target ) ; // If there is only a single target, do not group the condition. if ( count ( $ targets ) == 1 ) { $ this -> applyForSingleTarget ( $ query , head ( $ targets ) , $ value , true ) ; return ; } // If we combine with the 'or' operator, group the filter's conditions // so the relation with the other filters is kept inclusive. $ query -> where ( function ( $ query ) use ( $ targets , $ value ) { $ this -> combineOr = true ; foreach ( $ targets as $ index => $ singleTarget ) { $ this -> applyForSingleTarget ( $ query , $ singleTarget , $ value , $ index < 1 ) ; } } ) ; }
Applies the filter value to the query.

@param Builder $query
@param string  $target
@param mixed   $value
@param array   $parameters
Applies the filter value to the query .