@foreach ($siswa as $row) {{ $loop->iteration }} {{ $row->nis }} {{ $row->name }} {{ $row->jk }} @php $H = $absen->where('siswa_id', $row->id) ->whereIn('keterangan', ['H']) ->where('tanggal', '>=', $months[0]) ->where('tanggal', '<=', end($months)) ->whereNotIn('tanggal', $libur->pluck('tgl')) ->count(); $S = $absen->where('siswa_id', $row->id) ->whereIn('keterangan', ['S']) ->where('tanggal', '>=', $months[0]) ->where('tanggal', '<=', end($months)) ->whereNotIn('tanggal', $libur->pluck('tgl')) ->count(); $I = $absen->where('siswa_id', $row->id) ->whereIn('keterangan', ['I']) ->where('tanggal', '>=', $months[0]) ->where('tanggal', '<=', end($months)) ->whereNotIn('tanggal', $libur->pluck('tgl')) ->count(); $A = $absen->where('siswa_id', $row->id) ->whereIn('keterangan', ['A']) ->where('tanggal', '>=', $months[0]) ->where('tanggal', '<=', end($months)) ->whereNotIn('tanggal', $libur->pluck('tgl')) ->count(); @endphp {{ $H > 0 ? $H : '' }} {{ $S > 0 ? $S : '' }} {{ $I > 0 ? $I : '' }} {{ $A > 0 ? $A : '' }} @endforeach