@foreach ($grouped as $center_code => $records) @php $first = $records->first(); $collegeCount = $records->unique('college_code')->count(); @endphp

CENTER CODE & NAME: [{{ $center_code }}] - ({{ $first->c_col_code }}) {{ $first->c_col_name }} Total Colleges: {{ $collegeCount }}

@foreach ($records as $index => $row) @endforeach
SL COL CODE COLLEGE NAME COURSE
{{ $index + 1 }} {{ $row->college_code ?? '' }} {{ $row->college_name ?? '' }} {{ $row->course ?? '' }}
{{-- Optional page break between centers --}} {{--
--}} @endforeach