From c9c5ce6ee0e0203906119808d9cdf0d35fc6b038 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 2 Nov 2017 16:20:01 -0700 Subject: [PATCH] Return Deleted User if the user is invalid for some reason --- app/Http/Controllers/Api/ConsumablesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index e817c2b07..e4f5a7b51 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -181,7 +181,7 @@ class ConsumablesController extends Controller foreach ($consumable->consumableAssignments as $consumable_assignment) { $rows[] = [ - 'name' => $consumable_assignment->user->present()->nameUrl(), + 'name' => ($consumable_assignment->user) ? $consumable_assignment->user->present()->nameUrl() : 'Deleted User', 'created_at' => ($consumable_assignment->created_at->format('Y-m-d H:i:s')=='-0001-11-30 00:00:00') ? '' : $consumable_assignment->created_at->format('Y-m-d H:i:s'), 'admin' => ($consumable_assignment->admin) ? $consumable_assignment->admin->present()->nameUrl() : '', ];