diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php index 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;