How can I group data that has the same date or value in laravel kindly help me thank you. im not sure why it is not combining into one.
here is my code and i am also getting an error
ERROR
Undefined property: Illuminate\Database\MySqlConnection::$date_today
CONTROLLER
$employeeSched = DB::table('schedules')
->select('date_today')
->where('date_today', true) //date_today is my data field name
->groupBy('date_today');
VIEW
@foreach ($employeeSched as $setTime)
<tr>
<td> </td>
<td><input type="time" name="schedules[][timeIn]" class="form-control col-md-10" value=''></td>
<td><p>12:00 PM - 1:00 PM</p></td>
<td><input type="time" name="schedules[][timeOut]" class="form-control col-md-10" value=''></td>
<td>@php
$time1 = strtotime($setTime->time_in);
$time2 = strtotime($setTime->time_out);
$difference = round(abs($time2 - $time1) / 3600,2);
$total = $difference - 1;
echo '<b>' . $total . '</b>';
@endphp</td>
<td>
@php
if ($total < 8) {
echo '<b>Under Time</b>';
} else if($total > 8) {
echo '<b>OT</b>';
} elseif ($total < 8.5 && $total == 8) {
echo '<b>In</b>';
}
@endphp
</td>
</tr>
@endforeach
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire