@php $contadorCols = 0; $rowNumber = 0; $page = 1; $oldPage = 1; @endphp @foreach($codes as $index => $code) @php if($contadorCols == 1){ $contadorCols = 0; $rowNumber++; if($rowNumber === 5){ $rowNumber = 0; $page += 1; echo '
   
{{ $code->code }}
N°{{ $code->correlative }}
N°{{ $code->correlative }}
'; }else{ echo ''; } }else{ $contadorCols ++; } @endphp @endforeach