I have display quantity and price attributes on my table from database but for some reasons I don't save the total into database but I display total by multiplying quantity * total
on the table when data is being fetched.
Total for every column on my table is being displayed accurately. Is there a way that I can add all total columns on the table in my html?
PS: with my code, it only displays the total of the current column of the table
Table
<tbody>
@foreach($items as $items)
<tr>
<td>{{$item>id }}</td>
<td>{{$item->quantity}}</td>
<td>{{ $item->price}}</td>
<td>{{ $item->quantity * $item->price}}</td>
</tr>
@endforeach
<p>Sum: {{ $item->quantity * $item->price}}</p>
</tbody>