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;
}
這句法似乎不工作?可能嗎?