public function scopeSearch($query, $term)
    {
        $columns = implode(',', $this->searchable);

        $query->whereRaw("MATCH ({$columns}) AGAINST (? IN BOOLEAN MODE)", $this->fullTextWildcards($term));

        // $term = $this->fullTextWildcards($term);
        //
        // $query
        //     ->selectRaw('MATCH (title, content) AGAINST (? in boolean mode) as REL', [$term])
        //     ->whereRaw('MATCH (title, content) AGAINST (? in boolean mode)' , $term)
        //     ->orderBy('REL', 'desc')
        //     ;

        return $query;
    }
public function scopeSearch($query, $term)
    {
        $columns = implode(',', $this->searchable);

        $query->whereRaw("MATCH ({$columns}) AGAINST (? IN BOOLEAN MODE)", $this->fullTextWildcards($term));

        // $term = $this->fullTextWildcards($term);
        //
        // $query
        //     ->selectRaw('MATCH (title, content) AGAINST (? in boolean mode) as REL', [$term])
        //     ->whereRaw('MATCH (title, content) AGAINST (? in boolean mode)' , $term)
        //     ->orderBy('REL', 'desc')
        //     ;

        return $query;
    }
public function scopeSearch ( $ query , $ term ) { $ columns = implode ( ',' , $ this -> searchable ) ; $ query -> whereRaw ( "MATCH ({$columns}) AGAINST (? IN BOOLEAN MODE)" , $ this -> fullTextWildcards ( $ term ) ) ; // $term = $this->fullTextWildcards($term); // // $query //     ->selectRaw('MATCH (title, content) AGAINST (? in boolean mode) as REL', [$term]) //     ->whereRaw('MATCH (title, content) AGAINST (? in boolean mode)' , $term) //     ->orderBy('REL', 'desc') //     ; return $ query ; }
Scope a query that matches a full text search of term.

@param \Illuminate\Database\Eloquent\Builder $query
@param string $term
@return \Illuminate\Database\Eloquent\Builder
Scope a query that matches a full text search of term .