public function hasTerm($term_id) {
    $term = ($term_id instanceof Term) ? $term_id : Term::findOrFail($term_id);

    $term_relation = [
      'term_id' => $term->id,
      'vocabulary_id' => $term->vocabulary_id,
    ];

    return ($this->related()->where('term_id', $term_id)->count()) ? TRUE : FALSE;
  }
public function hasTerm($term_id) {
    $term = ($term_id instanceof Term) ? $term_id : Term::findOrFail($term_id);

    $term_relation = [
      'term_id' => $term->id,
      'vocabulary_id' => $term->vocabulary_id,
    ];

    return ($this->related()->where('term_id', $term_id)->count()) ? TRUE : FALSE;
  }
public function hasTerm ( $ term_id ) { $ term = ( $ term_id instanceof Term ) ? $ term_id : Term :: findOrFail ( $ term_id ) ; $ term_relation = [ 'term_id' => $ term -> id , 'vocabulary_id' => $ term -> vocabulary_id , ] ; return ( $ this -> related ( ) -> where ( 'term_id' , $ term_id ) -> count ( ) ) ? TRUE : FALSE ; }
Check if the Model instance has the passed term as an existing relation

@param mixed $term_id
The ID of the term or an instance of the Term object

@return object
The TermRelation object
Check if the Model instance has the passed term as an existing relation