src/Traits/HasTaxonomies.php
public function getTerm($term_name, $taxonomy = '')
    {
        if ($taxonomy) {
            $term_ids = $this->taxonomies->where('taxonomy', $taxonomy)->pluck('term_id');
        } else {
            $term_ids = $this->getTaxonomies('term_id');
        }

        return Term::whereIn('id', $term_ids)->where('name', $term_name)->first();
    }
public function getTerm($term_name, $taxonomy = '')
    {
        if ($taxonomy) {
            $term_ids = $this->taxonomies->where('taxonomy', $taxonomy)->pluck('term_id');
        } else {
            $term_ids = $this->getTaxonomies('term_id');
        }

        return Term::whereIn('id', $term_ids)->where('name', $term_name)->first();
    }
public function getTerm ( $ term_name , $ taxonomy = '' ) { if ( $ taxonomy ) { $ term_ids = $ this -> taxonomies -> where ( 'taxonomy' , $ taxonomy ) -> pluck ( 'term_id' ) ; } else { $ term_ids = $ this -> getTaxonomies ( 'term_id' ) ; } return Term :: whereIn ( 'id' , $ term_ids ) -> where ( 'name' , $ term_name ) -> first ( ) ; }
Get a term model by the given name and optionally a taxonomy.

@param  string  $term_name
@param  string  $taxonomy
@return mixed
Get a term model by the given name and optionally a taxonomy .