Why not just group them by date (possibly excluding the year) ?
Jul 2, 2016
4
Level 18
Multiple Group By?
Hello,
I currently have this query:
$performances = Performance::with('programme')
->orderBy('start_date', 'ASC')
->available()
->get()
->groupBy(function($item) {
return $item->start_date->format('F');
});
I'm just getting some performances and grouping them by the month.
How can I amend this to also group those within a month by the date also?
So I'd potentially have a collection with the following structure:
- Performances
- January
- 16th
- [Performance]
- [Performance]
- [Performance]
- 22nd
- [Performance]
- 29th
- [Performance]
- [Performance]
- March
- 3rd
- [Performance]
- [Performance]
- 7th
- [Performance]
- December
- 20th
- [Performance]
I hope this makes sense?
Please or to participate in this conversation.