【发布时间】:2020-06-29 22:46:48
【问题描述】:
当我在 laravel 中使用 groupBy 时
我将它用于 api 但响应显示如下示例
$data = Order::where('id_user',Auth::id())->with('resturant')->orderBy('created_at', 'desc')->get()->groupBy('uuid');
return response()->json([
'data'=>$dataa,
'state'=>true,
]);
响应显示
"data": {
"11447": [
{
"id": 75704,
"uuid": "11447",
...........
"resturant": {
"id": 5,
"category_id": 1,
...........
}
}
],
"49262": [
{
"id": 75702,
"uuid": "49262",
...........
"resturant": {
"id": 5,
"category_id": 1,
...........
}
},
]
},
"state": true
}
我需要删除对象中的数字
“11447”:[
怎么样?!
【问题讨论】:
-
这能回答你的问题吗? How to index count from json in Laravel