我试图在返回对 api 的响应之前删除 created_at 和 updated_at 。我想从Place_Type 和 Places中删除这些字段, 我该怎么做?: 我试过: unset(placetypes) 但没用
这是我的代码:
public function places()
{
$placeType = PlaceType::with('places')->where('id', 1)->get();
return response()->json(['placeType' => $placeType]);
}
请求结果:
"placeType": [
{
"id": 1,
"name": "Moriah O'Conner",
"icon": "https://picsum.photos/200/300",
"status": 1,
"created_at": "2019-12-14 18:23:19",
"updated_at": "2019-12-14 18:23:19",
"places": [
{
"id": 1,
"name": "Linda Leffler",
"description": "Alice's shoulder, and it set to work, and very soon came to ME, and told me he was in the air. She did it so VERY remarkable in that; nor did Alice think it would feel very queer to ME.' 'You!' said.",
"icon": "https://picsum.photos/200/300",
"image_name": "https://picsum.photos/200/300",
"rating": 2,
"longitude": -53.389979,
"latitude": 19.633458,
"availability": 1,
"status": 1,
"place_type_id": 1,
"created_at": "2019-12-14 18:23:19",
"updated_at": "2019-12-14 18:23:19"
},
{
"id": 2,
"name": "Lauren Cartwright",
"description": "I should say \"With what porpoise?\"' 'Don't you mean by that?' said the King. 'I can't remember half of anger, and tried to look at it!' This speech caused a remarkable sensation among the leaves.",
}...,
}
慕工程0101907
忽然笑
呼啦一阵风
DIEA
噜噜哒
牧羊人nacy
随时随地看视频慕课网APP