Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
 public function getBySlug($slug)
 {
     return Entities::with('links', 'subtypes')->whereSlug($slug)->first();
 }