i have a table called transaction, and in the table i have 3 columns called Amount, Profit and Status. in my blade file i have a table where i'm displaying each week total amount , total profit and count the status of each week.
i am stranded cause i don't know how to implement this
this is my controller so far.
$transact = Transaction::select('amount', 'profit', 'status')->get()
->groupBy(function($row){
return $row->created_at->format('W');
});
and my blade
<tbody>
@foreach ($transact as $key=> $dae)
<tr>
<td>this is meant to display the week but i don't know how to do it</td>
<td>{{ $dae->count() }}</td>
<td>this is meant to display the sum of the 'amount' for the week</td>
<td>this is meant to display the sum of the 'profit' for the week </td>
<td>this is meant to display the count of 'status' for the week</td>
</tr>
@endforeach
</tbody>