From 139325d8bacf3602bc7c885aaf9d5f9dd62a87eb Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 1 Aug 2016 10:17:46 -0700 Subject: [PATCH] Small tweaks for bad data --- app/Models/Asset.php | 5 ++++- resources/views/dashboard.blade.php | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Models/Asset.php b/app/Models/Asset.php index c88c27956f..3531b55043 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -376,7 +376,10 @@ class Asset extends Depreciable { if ($this->name == '') { - return $this->model->name.' ('.$this->asset_tag.')'; + if ($this->model) { + return $this->model->name.' ('.$this->asset_tag.')'; + } + return $this->asset_tag; } else { return $this->name; } diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index bc188450a9..88fe0bfa8d 100755 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -120,7 +120,11 @@ {{ date("M d, Y g:iA", strtotime($activity->created_at)) }} @if ($activity->action_type!='requested') - {{ $activity->adminlog->fullName() }} + @if ($activity->adminlog) + {{ $activity->adminlog->fullName() }} + @else + Deleted Admin + @endif @endif