A free open source IT asset/license management system
Catch weird edge case where target wouldn’t have an ID (?!)
snipecf9d0201e0d3
diff --git a/app/Models/Loggable.php b/app/Models/Loggable.phpindex f2a96ca99b..37de7925e7 100644--- a/app/Models/Loggable.php+++ b/app/Models/Loggable.php@@ -45,9 +45,15 @@ trait Loggable$log->user_id = Auth::user()->id;if (!isset($target)) {- throw new Exception('All checkout logs require a target');+ throw new Exception('All checkout logs require a target.');return;}++ if (!isset($target->id)) {+ throw new Exception('That target seems invalid (no target ID available).');+ return;+ }+$log->target_type = get_class($target);$log->target_id = $target->id;