0
我所有的比賽由起始日期排序的,但我想要的日期不顯示始終,而不是按日期像下面分開隊:集團通過雄辯laravel
$matches=Match::orderBy('start_date','desc')->get();
foreach($matches as $match)
{
$match->team1;
$match->team2;
$match->start_date;
}
這給:
Team1
Team2
2016-9-28
Team3
Team4
2016-9-28
Team5
Team6
2016-9-28
...
相反,我想
2016-9-28
Team1
Team2
Team3
Team4
Team5
Team6
....
2016-9-29
Team1
Team2
Team3
....
GROUP_BY起始日期可能?
$ startDate沒有給出日期。還有'foreach($匹配$匹配)'給出錯誤。 – Steve
@Steve查看更新的答案。 'groupBy'應該在'get'之後出現 – chanafdo