Exemple #1
0
 /**
  * Attach Subtypes
  * @param  Entities $entity   
  * @property string $id Subtype Id To Attach
  * @param  Subtypes $subtypes 
  * @return void
  */
 public function attachSubtypes($entity, $subtypes)
 {
     foreach ($subtypes as $name) {
         $subtype_object = Subtypes::make($name);
         $new_subtype = $this->subtypes->save($subtype_object);
         $entity->subtypes()->attach($new_subtype->id);
     }
 }
Exemple #2
0
 public function getByName($name)
 {
     return Subtypes::whereName($name)->first();
 }