public function apply(Collection $collection)
    {
        $this->collection = $collection;

        foreach ($this->filters() as $name => $value) {
            if (! method_exists($this, $name)) {
                continue;
            }

            if (is_array($value) or trim($value)) {
                $this->collection = $this->$name($value);
            } else {
                $this->collection = $this->$name();
            }
        }

        return $this->collection;
    }
public function apply(Collection $collection)
    {
        $this->collection = $collection;

        foreach ($this->filters() as $name => $value) {
            if (! method_exists($this, $name)) {
                continue;
            }

            if (is_array($value) or trim($value)) {
                $this->collection = $this->$name($value);
            } else {
                $this->collection = $this->$name();
            }
        }

        return $this->collection;
    }
public function apply ( Collection $ collection ) { $ this -> collection = $ collection ; foreach ( $ this -> filters ( ) as $ name => $ value ) { if ( ! method_exists ( $ this , $ name ) ) { continue ; } if ( is_array ( $ value ) or trim ( $ value ) ) { $ this -> collection = $ this -> $ name ( $ value ) ; } else { $ this -> collection = $ this -> $ name ( ) ; } } return $ this -> collection ; }
Apply the filters to the collection.

@param Collection $collection

@return Collection
Apply the filters to the collection .