anybody got any ideas? maybe if it was grouped by date and then by time with multiple records under each I want to show my fixtures like this http://www.bbc.co.uk/sport/football/fixtures Cheers
GroupBy date then by another column within date
I'm building a site that has fixtures that are grouped by date, this bit works fine. But I want to be able to then group the fixtures for a date by the type of fixture, i.e. league or cup, the id is held in the fixtures but the title is in a related table. so the result is like this:
Date 1. League fixtures. Team 1 v Team 2. Team 3 v Team 4. Cup fixtures. Team 5 v Team 6. Team 7 v Team 8.
Date 1 League fixtures Team 1 v Team 2 Team 3 v Team 4 Cup fixtures Team 5 v Team 6 Team 7 v Team 8
So I need some help in doing this last bit of grouping the fixtures by type
this is the query
$fixtures = Fixtures::with('home_team')
->with('away_team')
->with('venue')
->with('result')
->with('type')
->get();
$fixtures = $fixtures->groupBy('simpleDate', 'fixture_type');
dd($fixtures);
current dd of group by date
Collection {#271 ▼
#items: array:2 [▼
"2015-09-01" => Collection {#270 ▶}
"2015-09-02" => Collection {#290 ▼
#items: array:2 [▼
0 => Fixtures {#281 ▶}
1 => Fixtures {#282 ▶}
]
}
]
}
Cheers
Please or to participate in this conversation.