我在Laravel Applicaiton中从我的控制器返回一组数据。但是,我想简化数据,以便我可以更轻松地访问属性。这就是我所拥有的:
"sub_categories": [
[
{
"id": 1,
"name": "Accounting"
}
],
[
{
"id": 2,
"name": "Business"
}
],
[
{
"id": 3,
"name": "Engineering"
}
],
]
这就是我想要归档的内容:
"sub_categories": [
{
"id": 1,
"name": "Accounting"
},
{
"id": 2,
"name": "Business"
},
{
"id": 3,
"name": "Engineering"
}
]