Have a collection and want to group the results by week starting on Wednesday.
Have this, but return the key correctly, but not the results:
$all_days = $all_days->groupBy(function($date) {
$event_start = Carbon::parse($date->event_start);
$start = $event_start->startOfWeek()->addDays(2)->format('Y-m-d');
$end = $event_start->endOfWeek()->addDays(2)->format('Y-m-d');
return "{$start} - {$end}";
});
So they key in the collection are correct but the data is being return group by weeks starting on Monday.