'boolean', 'dum' => 'datetime:d/m/Y', ]; protected $fillable = [ 'atendimento_triagem_id', 'atendimento_medico_id', 'atendimento_enfermagem_id', 'paciente_observacao_id', 'gestante', 'dum', ]; protected $hidden = [ 'created_at', 'created_lotacao_id', 'created_centro_custo_id', 'updated_at', 'updated_lotacao_id', 'updated_centro_custo_id', 'deleted_at', 'deleted_lotacao_id', 'deleted_centro_custo_id', ]; protected $appends = [ 'idade_gestacional', 'dpp' ]; public function atendimento() { return $this->belongsTo(Atendimento::class); } public function atendimentoMedico() { return $this->belongsTo(AtendimentoMedico::class); } public function atendimentoEnfermagem() { return $this->belongsTo(AtendimentoEnfermagem::class); } public function getIdadeGestacionalAttribute() { if (!is_null($this->dum)) { return GestacaoService::getIdadeGestacional($this->dum); } } public function getDppAttribute() { if (!is_null($this->dum)) { $dum = GestacaoService::getDataPrevistaParto(Carbon::parse($this->dum))->toDateString(); return Carbon::create($dum)->format('d/m/Y'); } } public function getIsAllowedToDeleteAttribute() { return true; } }