public function getTermsByVocabularyNameAsArray($name) {
    $vocabulary = \Taxonomy::getVocabularyByName($name);

    $term_relations = $this->related()->where('vocabulary_id', $vocabulary->id)->get();

    $data = [];
    foreach ($term_relations as $term_relation) {
      $data[$term_relation->term->id] = $term_relation->term->name;
    }

    return $data;
  }
public function getTermsByVocabularyNameAsArray($name) {
    $vocabulary = \Taxonomy::getVocabularyByName($name);

    $term_relations = $this->related()->where('vocabulary_id', $vocabulary->id)->get();

    $data = [];
    foreach ($term_relations as $term_relation) {
      $data[$term_relation->term->id] = $term_relation->term->name;
    }

    return $data;
  }
public function getTermsByVocabularyNameAsArray ( $ name ) { $ vocabulary = \ Taxonomy :: getVocabularyByName ( $ name ) ; $ term_relations = $ this -> related ( ) -> where ( 'vocabulary_id' , $ vocabulary -> id ) -> get ( ) ; $ data = [ ] ; foreach ( $ term_relations as $ term_relation ) { $ data [ $ term_relation -> term -> id ] = $ term_relation -> term -> name ; } return $ data ; }
Get all the terms for a given vocabulary that are linked to the current
Model as a key value pair array.

@param $name string
The name of the vocabulary

@return array
A key value pair array of the type 'id' => 'name'
Get all the terms for a given vocabulary that are linked to the current Model as a key value pair array .