private function query()
    {
        foreach ($this->search_models as $model_name => $filters) {
            // Apply search against the original model.
            if ($model_name === 'self') {
                self::applySearch($this->query, $filters);
                continue;
            }

            // Apply search against the related model.
            $this->query->whereHas($model_name, function ($query) use ($filters) {
                self::applySearch($query, $filters);
            });
        }

        return $this->query;
    }
private function query()
    {
        foreach ($this->search_models as $model_name => $filters) {
            // Apply search against the original model.
            if ($model_name === 'self') {
                self::applySearch($this->query, $filters);
                continue;
            }

            // Apply search against the related model.
            $this->query->whereHas($model_name, function ($query) use ($filters) {
                self::applySearch($query, $filters);
            });
        }

        return $this->query;
    }
private function query ( ) { foreach ( $ this -> search_models as $ model_name => $ filters ) { // Apply search against the original model. if ( $ model_name === 'self' ) { self :: applySearch ( $ this -> query , $ filters ) ; continue ; } // Apply search against the related model. $ this -> query -> whereHas ( $ model_name , function ( $ query ) use ( $ filters ) { self :: applySearch ( $ query , $ filters ) ; } ) ; } return $ this -> query ; }
Run the query.

@return builder
Run the query .