I am trying to build a time-tracker, in where it has a 'time_tracks' table. An employee can track the time many times in a single day. Now I want to sum the 'total_time' where 'track_date' are same. Would someone help me to find out the expected results, please! Here is my 'trackForToday' function is bellow-
public function trackForToday()
{
$user_id = Auth::user()->id;
$last_date = TimeTrack::where('employee_id', $user_id)->select('track_date')->orderBy('track_date', 'DESC')->first();
$last_work_time = TimeTrack::where('employee_id', $user_id)->where('track_date', $last_date->track_date)->get();
return view('employee.time-tracker.today');
}