mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Handle shitty edge cases where an asset has no model without crashing
This commit is contained in:
parent
1dae7a2fe4
commit
2c2910d1dd
|
@ -38,11 +38,11 @@ class AssetsTransformer
|
|||
'status_type'=> e($asset->assetstatus->getStatuslabelType()),
|
||||
'status_meta' => e($asset->present()->statusMeta),
|
||||
] : null,
|
||||
'category' => ($asset->model->category) ? [
|
||||
'category' => (($asset->model) && ($asset->model->category)) ? [
|
||||
'id' => (int) $asset->model->category->id,
|
||||
'name'=> e($asset->model->category->name)
|
||||
] : null,
|
||||
'manufacturer' => ($asset->model->manufacturer) ? [
|
||||
'manufacturer' => (($asset->model) && ($asset->model->manufacturer)) ? [
|
||||
'id' => (int) $asset->model->manufacturer->id,
|
||||
'name'=> e($asset->model->manufacturer->name)
|
||||
] : null,
|
||||
|
|
Loading…
Reference in a new issue