src/Models/Taxonomy.php
public function scopeSearch($query, $searchTerm, $taxonomy = 'major')
    {
        return $query->whereHas('term', function($q) use($searchTerm, $taxonomy) {
            $q->where('name', 'like', '%'. $searchTerm .'%');
        });
    }
public function scopeSearch($query, $searchTerm, $taxonomy = 'major')
    {
        return $query->whereHas('term', function($q) use($searchTerm, $taxonomy) {
            $q->where('name', 'like', '%'. $searchTerm .'%');
        });
    }
public function scopeSearch ( $ query , $ searchTerm , $ taxonomy = 'major' ) { return $ query -> whereHas ( 'term' , function ( $ q ) use ( $ searchTerm , $ taxonomy ) { $ q -> where ( 'name' , 'like' , '%' . $ searchTerm . '%' ) ; } ) ; }
A simple search scope.

@param  object  $query
@param  string  $searchTerm
@param  string  $taxonomy
@return mixed
A simple search scope .