diff --git a/app/Http/Resources/Mis/SttMedicalHistoryResource.php b/app/Http/Resources/Mis/SttMedicalHistoryResource.php index 638eae3..3195cba 100644 --- a/app/Http/Resources/Mis/SttMedicalHistoryResource.php +++ b/app/Http/Resources/Mis/SttMedicalHistoryResource.php @@ -22,7 +22,7 @@ class SttMedicalHistoryResource extends JsonResource 'dateextract' => Carbon::parse($this->DateExtract)->format('d.m.Y'), 'card_num' => $this->archiveInfo->num ?? null, 'status' => $this->archiveInfo->status ?? null, - 'datearhiv' => $this->archiveInfo?->post_at ? Carbon::parse($this->archiveInfo->post_at)->format('d.m.Y') : null, + 'datearhiv' => $this->whenLoaded('archiveInfo') ? Carbon::parse($this->archiveInfo->post_in)->format('d.m.Y') : null, 'medcardnum' => $this->MedCardNum, 'dr' => Carbon::parse($this->BD)->format('d.m.Y'), 'can_be_issue' => $this->canBeIssued() diff --git a/app/Http/Resources/SI/SttMedicalHistoryResource.php b/app/Http/Resources/SI/SttMedicalHistoryResource.php index 3b0522a..92cee8d 100644 --- a/app/Http/Resources/SI/SttMedicalHistoryResource.php +++ b/app/Http/Resources/SI/SttMedicalHistoryResource.php @@ -22,7 +22,7 @@ class SttMedicalHistoryResource extends JsonResource 'dateextract' => Carbon::parse($this->dateextract)->format('d.m.Y'), 'card_num' => $this->archiveInfo->num ?? null, 'status' => $this->archiveInfo->status ?? null, - 'datearhiv' => $this->archiveInfo?->post_at ? Carbon::parse($this->archiveInfo->post_at)->format('d.m.Y') : null, + 'datearhiv' => $this->whenLoaded('archiveInfo') ? Carbon::parse($this->archiveInfo->post_in)->format('d.m.Y') : null, 'medcardnum' => $this->medcardnum, 'dr' => Carbon::parse($this->dr)->format('d.m.Y'), 'can_be_issue' => $this->canBeIssued()