public function search($query, $columns = null, $fulltext = true, $threshold = null)
    {
        if (is_bool($columns)) {
            list($fulltext, $columns) = [$columns, []];
        }

        $parser = static::$parser->make();

        $words = is_array($query) ? $query : $parser->parseQuery($query, $fulltext);

        $columns = $parser->parseWeights($columns ?: $this->model->getSearchableColumns());

        if (count($words) && count($columns)) {
            $this->query->from($this->buildSubquery($words, $columns, $threshold));
        }

        return $this;
    }
public function search($query, $columns = null, $fulltext = true, $threshold = null)
    {
        if (is_bool($columns)) {
            list($fulltext, $columns) = [$columns, []];
        }

        $parser = static::$parser->make();

        $words = is_array($query) ? $query : $parser->parseQuery($query, $fulltext);

        $columns = $parser->parseWeights($columns ?: $this->model->getSearchableColumns());

        if (count($words) && count($columns)) {
            $this->query->from($this->buildSubquery($words, $columns, $threshold));
        }

        return $this;
    }
public function search ( $ query , $ columns = null , $ fulltext = true , $ threshold = null ) { if ( is_bool ( $ columns ) ) { list ( $ fulltext , $ columns ) = [ $ columns , [ ] ] ; } $ parser = static :: $ parser -> make ( ) ; $ words = is_array ( $ query ) ? $ query : $ parser -> parseQuery ( $ query , $ fulltext ) ; $ columns = $ parser -> parseWeights ( $ columns ? : $ this -> model -> getSearchableColumns ( ) ) ; if ( count ( $ words ) && count ( $ columns ) ) { $ this -> query -> from ( $ this -> buildSubquery ( $ words , $ columns , $ threshold ) ) ; } return $ this ; }
Search through any columns on current table or any defined relations
and return results ordered by search relevance.

@param  array|string $query
@param  array $columns
@param  boolean $fulltext
@param  float $threshold
@return $this
Search through any columns on current table or any defined relations and return results ordered by search relevance .