@php
$studentsArray = collect($students)->values()->all();
$totalStudents = count($studentsArray);
$totalPages = max(1, ceil($totalStudents / 8));
@endphp
@for($pageIndex = 0; $pageIndex < $totalPages; $pageIndex++)
@for($rowIndex = 0; $rowIndex < 4; $rowIndex++)
@for($colIndex = 0; $colIndex < 2; $colIndex++)
@php
$cardPosition = ($pageIndex * 8) + ($rowIndex * 2) + $colIndex;
$student = $cardPosition < $totalStudents ? $studentsArray[$cardPosition] : null;
@endphp
@if($student)
{{ $student['first_name'] }}@if(!empty($student['last_name'])) {{ $student['last_name'] }}.@endif
Username:
{{ $student['username'] }}
Password:
{{ $student['password'] }}
https://www.readingful.com
@else
@endif
@endfor
@endfor