SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT time(sum(TIMEDIFF( shift_end_time, shift_start_time ))) from `shifts` whe' at line 1 (SQL: select SELECT time(sum(TIMEDIFF( shift_end_time, shift_start_time ))) from `shifts` where `time_sheet_id` = 29)
$no_of_hours = DB::Table('shifts')
->where('time_sheet_id','=', $timesheet_id->id)
->selectRaw('SELECT time(sum(TIMEDIFF( shift_end_time, shift_start_time )))')
->get();
If you follow the advice above and get the total number of hours for each timesheet, your result set should be a collection which you can then just use the sum() method on to sum the results.
Remember too that if you have multiple users tracking time sheets, you'll need to take that into consideration and include a user_id field in your results.