So i am dealing with coupons that I need to print. I prepared the view and I am passing coupons to the view:
public function printSelected($ids){
$couponIDs = explode(',', $ids);
$selectedCoupons = Coupon::find($couponIDs);
return view('admin.coupons.print')->with(compact('selectedCoupons'));
}
Now I need to loop through them in a certain manner.
every 10 coupons I need a new "page" block because 10 coupons fit into a page block
every second coupon I need a new table row because 2 coupons or table data fits into one row
<div class="coupons">
<!-- every 10 coupons I need a new "page" block because 10 coupons fit into a page block -->
<div class="page">
<div class="subpage">
<table>
<!-- every second coupon I need a new table row because 2 coupons or table data fits into one row -->
<tr>
<td>
<span class="coupon">{{ $coupon->code }}</span><br>
<hr>
<span class="name">{{ $coupon->user->name }}</span>
</td>
<td>
<span class="coupon">{{ $coupon->code }}</span><br>
<hr>
<span class="name">{{ $coupon->user->name }}</span>
</td>
</tr>
</table>
</div>
</div>
</div>
ForEach with every 10th and 2nd changes
So i am dealing with coupons that I need to print. I prepared the view and I am passing coupons to the view:
Now I need to loop through them in a certain manner.
Any ideas? Help is appreciated.