public function addTerm($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()->save(new TermRelation($term_relation));
  }
public function addTerm($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()->save(new TermRelation($term_relation));
  }
public function addTerm ( $ 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 ( ) -> save ( new TermRelation ( $ term_relation ) ) ; }
Add an existing term to the inheriting model

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

@return object
The TermRelation object
Add an existing term to the inheriting model