0
我已阅读了如何temporarily hide model attributes。 我想暂时隐藏模型关系属性。如何用Laravel 5暂时隐藏模型关系属性
例如
{
"slug": "google-chrome",
"name": "Google Chrome",
"description": {
"text": null,
"created_at": "2016-12-05 12:16:38",
"updated_at": "2016-12-05 12:16:38"
}
什么是仅在此查询隐藏description.created_at语法? 在我SoftwareController我有
public function show(Request $request, $slug)
{
$models = Software::query();
$model =
$models
->where('slug', $slug)
->firstOrFail()
->makeHidden([
'description.created_at',
]);
return $model;
}
这句法似乎不工作?可能吗?