I have some data like bellow and i want to show them as daily summation by duration column(in sec unit) from 7 days ago to 1 day ago (until yesterday), i use groupBy date and when i used where condition nothing returned, what's my wrong?
sorry for weak eng.lang., thank you
start_time end_time duration
2018-05-13 13:06:18 2018-05-13 13:15:07 529
2018-05-13 13:15:35 2018-05-13 13:29:05 810
...
2018-05-14 10:16:36 2018-05-14 10:16:54 18
...
and my controller function code is
public function userWeeklyTimes()
{
$times = Auth::user()->times()
->whereBetween('start_time', [Carbon::now()->subDays(7), Carbon::yesterday()])
->groupBy(DB::raw('DATE(start_time)'))
->selectRaw(
'sum(duration) as duration'
)->pluck('duration');
return $times;
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2x9kvnY
via IFTTT
Aucun commentaire:
Enregistrer un commentaire