I have a little code to group by day:
$data->get()->groupBy(function($data) {
return Carbon::parse($data->start)->format('Y-m-d');
});
I need this to display on chartjs as dataset and labels.
It works but, if there is no data for one date, it get skipped, case:
2019-02-01 - 5
2019-02-03 - 5
2019-02-04 - 5
But I would need something like this:
2019-02-01 - 5
2019-02-02 - 0
2019-02-03 - 5
2019-02-04 - 5
So is there a way to group by each day from between two dates?