@php
$tableWidth = 624;
$columnWidths = [
'name' => 28.66,
'group' => 13.36,
'username' => 29.32,
'password' => 28.66,
];
@endphp
@php
$rowsPerPage = 18; // Number of rows that fit nicely on a page
$studentChunks = collect($students)->chunk($rowsPerPage);
@endphp
@foreach($studentChunks as $pageIndex => $pageStudents)
@if($pageIndex > 0)
| Name |
Group |
Username |
Password |
@foreach($pageStudents as $student)
@php
$nameParts = preg_split('/\s+/', trim($student['name']));
$firstName = $nameParts[0] ?? '';
$formattedName = $firstName;
if (count($nameParts) > 1) {
$lastName = $nameParts[count($nameParts) - 1] ?? '';
if (!empty($lastName)) {
$formattedName .= ' ' . strtoupper(substr($lastName, 0, 1)) . '.';
}
}
@endphp
|
{{ $formattedName }}
|
{{ $student['group'] }}
|
{{ $student['username'] }}
|
{{ $student['password'] }}
|
@endforeach
@php
$emptyRows = $rowsPerPage - count($pageStudents);
@endphp
@for($i = 0; $i < $emptyRows; $i++)
| |
|
|
|
@endfor
Note: If you have a global password set, it has replaced the unique password for all students above—unless this setting is disabled within a student's account profile.
@endforeach