Level 88
You can use mapToGroups here as well
$data = (new Model)
->whereBetween(DB::raw('date(start)'), [$new_period->first()->format('Y-m-d'), $new_period>last()->format('Y-m-d')])
->select(DB::raw('id, date(start) as day'))
->get()
-> mapToGroups(function ($item, $key) {
return [$item['day'] => $item;
});
Documentation: https://laravel.com/docs/5.8/collections#method-maptogroups