I have a HTML table in which i want to display data retrieved from a database table.
I have successfully done this with php in the past but with Laravel, nothing is showing in the table: Below is the code for displaying the data in table
<tbody>
@php
$total_sales = 0;
$comm_total = 0;
@endphp
@foreach ($comm as $data){
$comm_total += $data->sales_comm;
$total_sales += $data->sales_total;
<tr>
<td>{{$data->sales_date}}</td>
<td>{{$data->sales_total}}</td>
<td>{{$data->sales_comm}}</td>
</tr>
@endforeach
I want every row in the database table with the ID of the logged in user and selected month and year to be retrieved and displayed in the blade table.
And here is the controller code
$comm = \DB::table('bakerysales')->where('customer_id', Auth()->id()
->whereMonth('sales_date', $request->input('mn'))
->whereYear('sales_date', $request->input('yr'))
->get();
return view('showCommission', compact('comm'));
dd()to dump out the value of$commas a starting point. - ceejayoz