问题描述
我正在制作一个个人博客,我需要按日期排序,从旧到新 这是我的代码
,date
2016-11-17,3403
2016-11-04,2605
2016-12-09,2285
2016-11-24,1934
2016-12-19,1874
2016-12-07,1864
2016-11-28,1825
2016-11-29,1715
2016-11-27,1688
2016-12-15,1683
2016-12-06,1680
当它们出来时,我需要帮助来反转它们。 提前致谢
解决方法
为了对 Laravel 集合进行排序,您可以使用:
const query = new Parse.Query('User'); query.equalTo('accountType','Student'); query.include('userProfile'); // search.subjects is an array query.containedIn('userProfile.subjectsIds',search.subjects);
sortBy()
您也可以在这里查看:Laravel Collection Avilable Methods
所以你可以使用 sortByDesc()