public function searchTerm($term, $vocabulary_id, $language_id = null, $exclude = [])
    {
        $language_id = $this->getLanguage($vocabulary_id, $language_id);

        $term = trim($term);
        if ($term == '') {
            return;
        }

        $query = TermData::select('taxonomy_terms.id')
            ->join('taxonomy_terms', 'taxonomy_terms.id', '=', 'taxonomy_terms_data.term_id')
            ->where('taxonomy_terms.vocabulary_id', $vocabulary_id)
            ->where('taxonomy_terms_data.language_id', $language_id)
            ->where('taxonomy_terms_data.title', $term);

        if (count($exclude)) {
            $query->whereNotIn('taxonomy_terms.id', $exclude);
        }

        return $query->value('id');
    }
public function searchTerm($term, $vocabulary_id, $language_id = null, $exclude = [])
    {
        $language_id = $this->getLanguage($vocabulary_id, $language_id);

        $term = trim($term);
        if ($term == '') {
            return;
        }

        $query = TermData::select('taxonomy_terms.id')
            ->join('taxonomy_terms', 'taxonomy_terms.id', '=', 'taxonomy_terms_data.term_id')
            ->where('taxonomy_terms.vocabulary_id', $vocabulary_id)
            ->where('taxonomy_terms_data.language_id', $language_id)
            ->where('taxonomy_terms_data.title', $term);

        if (count($exclude)) {
            $query->whereNotIn('taxonomy_terms.id', $exclude);
        }

        return $query->value('id');
    }
public function searchTerm ( $ term , $ vocabulary_id , $ language_id = null , $ exclude = [ ] ) { $ language_id = $ this -> getLanguage ( $ vocabulary_id , $ language_id ) ; $ term = trim ( $ term ) ; if ( $ term == '' ) { return ; } $ query = TermData :: select ( 'taxonomy_terms.id' ) -> join ( 'taxonomy_terms' , 'taxonomy_terms.id' , '=' , 'taxonomy_terms_data.term_id' ) -> where ( 'taxonomy_terms.vocabulary_id' , $ vocabulary_id ) -> where ( 'taxonomy_terms_data.language_id' , $ language_id ) -> where ( 'taxonomy_terms_data.title' , $ term ) ; if ( count ( $ exclude ) ) { $ query -> whereNotIn ( 'taxonomy_terms.id' , $ exclude ) ; } return $ query -> value ( 'id' ) ; }
Search a specific term, if it doesn't exist, returns false

@param  string $term
@param  int $vocabulary_id
@param  int $language_id
@param  array $exclude
@return int|null
Search a specific term if it doesn t exist returns false