From ac8da55270aa70697a100c08e1d88c94a3abeb69 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Sun, 1 May 2022 13:25:55 -0500 Subject: [PATCH] Evaluate if an item still exists before trying to get its name in the report --- app/Http/Controllers/ReportsController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 191f37156..3c27f386c 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -275,13 +275,18 @@ class ReportsController extends Controller } } + if($actionlog->item){ + $item_name = e($actionlog->item->getDisplayNameAttribute()); + } else { + $item_name = ''; + } $row = [ $actionlog->created_at, ($actionlog->user) ? e($actionlog->user->getFullNameAttribute()) : '', $actionlog->present()->actionType(), e($actionlog->itemType()), - ($actionlog->itemType() == 'user') ? $actionlog->filename : e($actionlog->item->getDisplayNameAttribute()), + ($actionlog->itemType() == 'user') ? $actionlog->filename : $item_name, $target_name, ($actionlog->note) ? e($actionlog->note) : '', $actionlog->log_meta,