I have below table with data.
ID - CLASS - CATEGORY - AMOUNT
--------------------------------
1 I A 5000
2 I B 6000
3 I C 7000
4 V A 9000
5 V B 12000
now I want to sum the amount classwise in blade.php using foreach loop. like class I total is 18000, class V 21000 etc..
Controller Function:
$viewRecords = YearlyFees::Where('registration_id',Auth::user()->id)->get();
return view('yearly_fees_setup',
['viewRecords' => $viewRecords]);
Blade.php
@foreach($viewRecords as $record)
<tr>
<td></td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td> ?????? TOTAL of each class </td></tr>
@endforeach
Result:
Class Category Amount
I School Fees 5000
I Tution Fees 6000
I Library Fees 7000
**I WANT TOTAL HERE**
V School Fees 9000
V Tution Fees 12000
**I WANT TOTAL HERE**
Please help
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2J6TmFm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire