@for ($i = 1; $i <= $daysInMonth; $i++) @endfor @foreach ($employees as $employee) @for ($i = 1; $i <= $daysInMonth; $i++) @php $date = \Carbon\Carbon::parse(request()->get('month') . '-' . str_pad($i, 2, '0', STR_PAD_LEFT)); $isSunday = $date->isSunday(); $attendance = $employee->attendances->where('check_in', $date->format('Y-m-d'))->first(); @endphp @endfor @endforeach
Employee{{ $i }}
{{ $employee->name }} @if ($isSunday) W @elseif ($attendance) @if ($attendance->status == 'P') P @elseif ($attendance->status == 'A') A @elseif ($attendance->status == 'L') L @elseif ($attendance->status == 'H') H @endif @else - @endif