I am trying to merge 2 foreach loop results into 1 table. Attached image.
Column1 Products:
$products=[{"product_name_id":"pro_des_5","quantity":180},{"product_name_id":"pro_des_6","quantity":240},{"product_name_id":"pro_des_7","quantity":156}];
Rest data:
$summary=[{"ptotal":1,"month":"March","product_id":"pro_des_7"},{"ptotal":3,"month":"April","product_id":"pro_des_5"},{"ptotal":2,"month":"April","product_id":"pro_des_6"},{"ptotal":12,"month":"April","product_id":"pro_des_7"}];
For each product there is per month consumption which I am trying to add under each month row getting data from $summary but unable to merge both foreach loop? Any advice.
<tbody>
@foreach($products as $product)
<tr>
<td></td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
@endforeach
</tbody>
via Zack