public function createTerm($vid, $name, $parent = 0, $weight = 0) {
    $vocabulary = $this->vocabulary->findOrFail($vid);

    $term = [
      'name' => $name,
      'vocabulary_id' => $vid,
      'parent' => $parent,
      'weight' => $weight,
    ];

    return $this->term->create($term);
  }
public function createTerm($vid, $name, $parent = 0, $weight = 0) {
    $vocabulary = $this->vocabulary->findOrFail($vid);

    $term = [
      'name' => $name,
      'vocabulary_id' => $vid,
      'parent' => $parent,
      'weight' => $weight,
    ];

    return $this->term->create($term);
  }
public function createTerm ( $ vid , $ name , $ parent = 0 , $ weight = 0 ) { $ vocabulary = $ this -> vocabulary -> findOrFail ( $ vid ) ; $ term = [ 'name' => $ name , 'vocabulary_id' => $ vid , 'parent' => $ parent , 'weight' => $ weight , ] ; return $ this -> term -> create ( $ term ) ; }
Create a new term in a specific vocabulary

@param int $vid
The Vocabulary ID in which to add the term

@param string $name
The name of the term

@param int $parent
The ID of the parent term if it is a child

@param int $weight
The weight of the term in order to sort them inside the Vocabulary

@return int
The ID of the created term

@thrown Illuminate\Database\Eloquent\ModelNotFoundException
Create a new term in a specific vocabulary