@php $titles = $data['sections'] ?? []; $descriptions = $data['descriptions'] ?? []; $isEdit = isset($data['sections']) && isset($data['descriptions']); // print_r($sections); // print_r($descriptions); // exit(); @endphp

Sections
@php $sections = []; if ($isEdit) { foreach ($titles as $i => $title) { $sections[] = [ 'title' => $title, 'description' => $descriptions[$i] ?? '', ]; } } else { $sections = [ [ 'title' => 'Cancellation Policy', 'description' => 'This service is non-refundable. Cancellations, missed appointments, or no-shows will be charged the full amount with no expectations.', ], [ 'title' => 'Changes to Booking', 'description' => 'Booking changes must be requested at least 24 hours in advance and are subject to availability. Last-minute changes may not be accomadated', ], [ 'title' => 'Extra Charges', 'description' => 'Additional changes may apply for extended wait times, schedule adjustments, added requests, or other circumstances outside the standard service scope.', ], ]; } @endphp @foreach ($sections as $index => $section)
@endforeach