O método está assim:
async show ({ params }) {
const id = Hashids.decode(params.id)
const camping = await Camping.query()
.where('id', '=', id)
.with('city')
.with('region')
.with('country')
.fetch()
return camping
}
Gostaria que fosse ser assim:
[
{
"id": 2,
"user_id": 1,
"country_id": 1,
"region_id": 1,
"city_id": 1,
"name": "Camping do Mazinho",
"address": null,
"lat": 0,
"lng": 0,
"claimed": 0,
"created_at": "2019-11-25 17:46:11",
"updated_at": "2019-11-25 17:46:11",
"hashids": "2YoWY0",
"city": {
"name": "Maresias"
},
"region": {
"name": "São Paulo",
"code": "sp"
},
"country": {
"name": "Brasil",
"code": "br"
}
}
]
Mas eu tenho isso:
[
{
"id": 2,
"user_id": 1,
"country_id": 1,
"region_id": 1,
"city_id": 1,
"name": "Camping do Mazinho",
"address": null,
"lat": 0,
"lng": 0,
"claimed": 0,
"created_at": "2019-11-25 17:46:11",
"updated_at": "2019-11-25 17:46:11",
"hashids": "2YoWY0",
"city": {
"id": 1,
"country_id": 1,
"region_id": 1,
"name": "Maresias",
"created_at": "2019-11-25 17:46:06",
"updated_at": "2019-11-25 17:46:06",
"hashids": "vY8qxN"
},
"region": {
"id": 1,
"country_id": 1,
"name": "São Paulo",
"code": null,
"created_at": "2019-11-25 17:14:22",
"updated_at": "2019-11-25 17:14:22",
"hashids": "vY8qxN"
},
"country": {
"id": 1,
"name": "Brasil",
"code": "br",
"created_at": "2019-11-25 17:12:47",
"updated_at": "2019-11-25 17:12:47"
}
}
]