Check for validity before trying to display relation data

This commit is contained in:
snipe 2017-01-13 22:06:12 -08:00
parent b462888850
commit f642013774

View file

@ -23,11 +23,11 @@ class AssetsTransformer
'name' => $asset->name,
'asset_tag' => $asset->asset_tag,
'serial' => $asset->serial,
'model' => $asset->model->name,
'model' => ($asset->model) ? $asset->model->name : '',
'model_number' => $asset->model_number,
'status_label' => $asset->assetstatus->name,
'status_label' => ($asset->assetstatus) ? $asset->assetstatus->name : '',
'last_checkout' => $asset->last_checkout,
'category' => $asset->model->category->name,
'category' => ($asset->model->category) ? $asset->model->category->name : '',
'manufacturer' => $asset->manufacturer,
'notes' => $asset->notes,
'expected_checkin' => $asset->expected_checkin,