Advertisement
rodro1

wrap every two items in a loop

Dec 21st, 2020
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. @php $i = 0; @endphp
  2. @foreach($orders as $order)
  3. @if($i%2 == 0)
  4. {{-- if the result of the modulo operation is 0, open new row --}}
  5. <div class="order-invoice-row">
  6. @endif
  7.  
  8. <div class="order-invoice-single-print">
  9. </div><!--order-invoice-single-print-->
  10.  
  11.  
  12. @if($i%2 == 1)
  13. </div><!--end of order-invoice-row-->
  14. @endif
  15.  
  16. @php $i++; @endphp
  17. @endforeach
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement