public function getElementoAttribute() { if (!empty($this->attributes['elemento_id'])) { return FarmaciaElemento::find($this->attributes['elemento_id']); } else { return null; } }
public function getElemento($id) { $elementos = FarmaciaElemento::find($id); return $elementos->elementos_filho()->get()->toJson(); }