From f642013774267d9d1192ff601d07ae8a17cdfcc2 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 13 Jan 2017 22:06:12 -0800 Subject: [PATCH] Check for validity before trying to display relation data --- app/Http/Transformers/AssetsTransformer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index 4860576c76..97f4225226 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -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,