mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Catch weird edge case where target wouldn’t have an ID (?!)
This commit is contained in:
parent
7ebd21bc04
commit
cf9d0201e0
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue