{{ count($cards) }} ID card{{ count($cards) == 1 ? '' : 's' }} · Fronts first, then backs. For double-sided printing, flip on the long edge. Switch on "Background graphics" in the print dialog.
@php $perSheet = 9; // long school names get a slightly smaller type so the whole name always fits in the card header $nl = mb_strlen($s['name'] ?? ''); $nameSize = $nl > 44 ? 5.6 : ($nl > 32 ? 6.4 : ($nl > 20 ? 7.4 : 8.4)); $fronts = array_chunk($cards, $perSheet); @endphp {{-- FRONTS --}} @foreach($fronts as $chunk)
Front side
@foreach($chunk as $c)
@if(!empty($s['logo']))@endif
{{ $s['name'] }}
{{ $c['name'] }}
@if($c['line1'])
{{ $c['line1'] }}
@endif @if($c['line2'])
{{ $c['line2'] }}
@endif
{{ $c['id_no'] }}
{!! $c['barcode'] !!}
@if(!empty($s['signature']))
Principal / Head Teacher
@endif
{{ $c['role'] }}
@endforeach
@endforeach {{-- BACKS: each row is mirrored so it lines up when printed double-sided (long-edge flip) --}} @foreach($fronts as $chunk)
Back side
@foreach(array_chunk($chunk, 3) as $row) @php $row = array_reverse($row); $pad = 3 - count($row); @endphp @for($i = 0; $i < $pad; $i++)
@endfor @foreach($row as $c)
@if(!empty($s['logo']))@endif

{{ $s['name'] }}

@if(!empty($s['motto']))
"{{ $s['motto'] }}"
@endif @if(!empty($s['address']))

{{ $s['address'] }}

@endif @if(!empty($s['phone']))

Tel: {{ $s['phone'] }}

@endif
This card is the property of {{ $s['name'] }}. If found, please return it to the school address above.
@if(!empty($s['signature']))@endif Principal / Head Teacher
@if($c['valid'])
{{ $c['valid'] }}
@endif
@endforeach @endforeach
@endforeach