public function getVocabularyByNameOptionsArray($name) {
    $vocabulary = $this->vocabulary->where('name', $name)->first();

    if (is_null($vocabulary)) {
      return [];
    }

    $parents = $this->term->whereParent(0)
      ->whereVocabularyId($vocabulary->id)
      ->orderBy('weight', 'ASC')
      ->get();

    $options = [];
    foreach ($parents as $parent) {
      $options[$parent->id] = $parent->name;
      $this->recurse_children($parent, $options);
    }

    return $options;
  }
public function getVocabularyByNameOptionsArray($name) {
    $vocabulary = $this->vocabulary->where('name', $name)->first();

    if (is_null($vocabulary)) {
      return [];
    }

    $parents = $this->term->whereParent(0)
      ->whereVocabularyId($vocabulary->id)
      ->orderBy('weight', 'ASC')
      ->get();

    $options = [];
    foreach ($parents as $parent) {
      $options[$parent->id] = $parent->name;
      $this->recurse_children($parent, $options);
    }

    return $options;
  }
public function getVocabularyByNameOptionsArray ( $ name ) { $ vocabulary = $ this -> vocabulary -> where ( 'name' , $ name ) -> first ( ) ; if ( is_null ( $ vocabulary ) ) { return [ ] ; } $ parents = $ this -> term -> whereParent ( 0 ) -> whereVocabularyId ( $ vocabulary -> id ) -> orderBy ( 'weight' , 'ASC' ) -> get ( ) ; $ options = [ ] ; foreach ( $ parents as $ parent ) { $ options [ $ parent -> id ] = $ parent -> name ; $ this -> recurse_children ( $ parent , $ options ) ; } return $ options ; }
Get a Vocabulary by name as an options array for dropdowns

@param string $name
The name of the Vocabulary to fetch

@return
The Vocabulary Model object, otherwise NULL
Get a Vocabulary by name as an options array for dropdowns