$groups = ProductGroup::all();
return view('seller.index',['groups'=>array_reverse($groups)];
如何正确使用?
答案 0 :(得分:0)
如果您想获取新记录,那么您应该尝试:
$groups = ProductGroup::orderBy("created_at,"DESC")->get();
return view('seller.index',['groups'=>$groups];
答案 1 :(得分:0)
$groups_reversed = clone (object)array_reverse((array)$groups);
答案 2 :(得分:-1)
使用reverse():
return view( 'seller.index', [ 'groups' => $groups->reverse() ];