@php use Carbon\Carbon; // تحويل التواريخ فقط إذا لم تكن فارغة $datesArray = collect($data['dates'])->filter(function ($date) { return !empty($date['course_date']); // إزالة القيم الفارغة })->map(function ($date) { return Carbon::parse($date['course_date'])->format('Y-m-d'); })->toArray(); // التأكد من أن selected_option ليست "null" النصية أو NULL قبل معالجتها $selectedOption = (!empty($data['selected_option']) && $data['selected_option'] !== "null") ? $data['selected_option'] : null; // التأكد من عدم تمرير null إلى Carbon::parse() $formattedDate1 = !is_null($selectedOption) ? Carbon::parse($selectedOption)->format('Y-m-d') : null; $isSelectedDateInDates = !empty($formattedDate1) && !in_array($formattedDate1, $datesArray); @endphp @if(!empty($datesArray)) @foreach($datesArray as $date) @php // التأكد من أن التاريخ غير فارغ قبل تمريره إلى Carbon $formattedDate2 = !empty($date) ? Carbon::parse($date)->format('Y-m-d') : null; @endphp {{$date ?? 'N/A'}} @endforeach @else @lang('pages.no_data_found') @endif