From 745178ce2e1ffa65e3b605cc97c49f9c703842bf Mon Sep 17 00:00:00 2001 From: Alex Popa Date: Thu, 9 Jan 2025 20:31:26 +0200 Subject: [PATCH] Display min 1 item in children table --- .../Resources/BeneficiaryResource/Pages/CreateBeneficiary.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php index f3571c6f..1efeb4dd 100644 --- a/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php +++ b/app/Filament/Organizations/Resources/BeneficiaryResource/Pages/CreateBeneficiary.php @@ -352,6 +352,10 @@ protected function getSteps(): array ->schema(EditChildrenIdentity::getChildrenIdentityFormSchema()) ->afterStateHydrated( function (Set $set) { + if (! $this->parentBeneficiary?->children->count()) { + return; + } + $children = $this->parentBeneficiary?->children->toArray() ?? []; foreach ($children as &$child) { $child['birthdate'] = $child['birthdate'] ? Carbon::parse($child['birthdate'])->format('d.m.Y') : null;