Check to see if model relationship exists before using it

This commit is contained in:
Marcus Moore 2023-06-27 19:35:55 -07:00
parent 49b50d81ee
commit ab51857854
No known key found for this signature in database

View file

@ -38,7 +38,7 @@ class AssetsTransformer
'byod' => ($asset->byod ? true : false),
'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
'eol' => ($asset->model->eol != '') ? $asset->model->eol : null,
'eol' => (($asset->model) && ($asset->model->eol != '')) ? $asset->model->eol : null,
'asset_eol_date' => ($asset->asset_eol_date != '') ? Helper::getFormattedDateObject($asset->asset_eol_date, 'date') : null,
'status_label' => ($asset->assetstatus) ? [
'id' => (int) $asset->assetstatus->id,