예제 #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);
     }
 }
예제 #2
0
 public function getByName($name)
 {
     return Subtypes::whereName($name)->first();
 }