From fc8637c81a89e5bf881b2d007f0cb32d5cee6238 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 7 Mar 2018 22:22:36 -0800 Subject: [PATCH] Check for associated maintenance asset This should probably never happen, but triggers on the demo sometimes because of fluctuating data seeding --- app/Http/Transformers/AssetMaintenancesTransformer.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Http/Transformers/AssetMaintenancesTransformer.php b/app/Http/Transformers/AssetMaintenancesTransformer.php index bd4afe8fc8..ab82157233 100644 --- a/app/Http/Transformers/AssetMaintenancesTransformer.php +++ b/app/Http/Transformers/AssetMaintenancesTransformer.php @@ -22,7 +22,6 @@ class AssetMaintenancesTransformer { $array = [ 'id' => (int) $assetmaintenance->id, - 'asset' => ($assetmaintenance->asset) ? [ 'id' => (int) $assetmaintenance->asset->id, 'name'=> ($assetmaintenance->asset->name) ? e($assetmaintenance->asset->name) : null, @@ -30,7 +29,7 @@ class AssetMaintenancesTransformer ] : null, 'title' => ($assetmaintenance->title) ? e($assetmaintenance->title) : null, - 'location' => ($assetmaintenance->asset->location) ? [ + 'location' => (($assetmaintenance->asset) && ($assetmaintenance->asset->location)) ? [ 'id' => (int) $assetmaintenance->asset->location->id, 'name'=> e($assetmaintenance->asset->location->name),