@php use Carbon\Carbon; $endDate = $endDate; $endday = \Carbon\Carbon::parse($endDate); $day = $endday->day; $dayInt = (int)$day; $startDate = $startDate; @endphp @foreach($acadmic_employees as $acadmic_employee)

{{$acadmic_employee->name}} {{$acadmic_employee->lname}}

@php $startDateCarbon = Carbon::parse($startDate); $endDateCarbon = Carbon::parse($endDate); @endphp @for ($currentDate = $startDateCarbon->copy(); $currentDate->lte($endDateCarbon); $currentDate->addDay()) @php $checkin = null; $leaveApplication = null; if ($acadmic_employee->attendance()) { $checkin = $acadmic_employee->attendance() ->whereDate('check_in', $currentDate->format('Y-m-d')) ->first(); } if ($acadmic_employee->leaveApplication) { $leaveApplication = $acadmic_employee->leaveApplication ->where('date_from', '<=', $currentDate->format('Y-m-d')) ->where('date_to', '>=', $currentDate->format('Y-m-d')) ->first(); } @endphp isFriday()|| $currentDate->isSaturday()) style="background-color: #dce0e1;" @endif> @if ($checkin && $leaveApplication)
@elseif ($checkin) @elseif ($leaveApplication) @else @endif @endfor @endforeach