Example #1
0
 public function getElementoAttribute()
 {
     if (!empty($this->attributes['elemento_id'])) {
         return FarmaciaElemento::find($this->attributes['elemento_id']);
     } else {
         return null;
     }
 }
Example #2
0
 public function postElementos()
 {
     $input = Input::all();
     foreach ($input['form'] as $elemento) {
         if ($elemento['name'] != 'elemento_add' && $elemento['value'] != null) {
             $e = ['elemento_pai' => $elemento['value']];
         }
     }
     $e = $e + ['descricao' => $input['form'][count($input['form']) - 1]['value']];
     return FarmaciaElemento::create($e);
 }