@php $type = $type ?? 'text'; $unit = $unit ?? null; $step = $step ?? null; $help = $help ?? null; $raw = $draftVisit->{$name} ?? ''; // Date fields need YYYY-MM-DD; a Carbon/DateTime renders as "2026-04-19 00:00:00" // which is not a valid value and silently appears blank. if ($type === 'date' && $raw instanceof \DateTimeInterface) { $raw = $raw->format('Y-m-d'); } $value = old($name, $raw); @endphp