@php $total = 0; $totalPresent = 0; $totalAbsent = 0; $totalNotMarked = 0; @endphp

Attendance Report



@foreach ($dateRange as $datenew) @if(in_array(\Carbon\Carbon::create($datenew)->format('Y-m-d'), $holidays)) @else @php $status = ''; $isWeekend = \Carbon\Carbon::create($datenew)->isWeekend(); // Check if the date is a weekend $attendanceFound = false; foreach ($attendances as $attendance) { if (\Carbon\Carbon::create($datenew)->equalTo(\Carbon\Carbon::create($attendance['date_of_attendance']))) { $attendanceFound = true; // Attendance found for this date if ($attendance['is_present'] == 1) { $status = 'Present'; $totalPresent++; } else { $status = 'Absent'; $totalAbsent++; } break; } } if (!$attendanceFound) { if ($isWeekend) { $status = 'Weekend'; } else { $status = 'Not Marked'; $totalNotMarked++; } } $total++; @endphp @if($status == 'Present') @elseif($status == 'Absent') @elseif($status == 'Weekend') @else @endif @endif @endforeach
Date Present Absent
{{ \Carbon\Carbon::create($datenew)->format('d M Y') }} Holiday {{$status}} {{$status}} {{$status}} {{$status}}