Check if target is not null to retrieve the proper data

This commit is contained in:
Ivan Nieto Vivanco 2023-02-27 19:01:37 -06:00
parent 9d94bd6567
commit 0d860c0b72

View file

@ -93,9 +93,13 @@ trait Loggable
{ {
$settings = Setting::getSettings(); $settings = Setting::getSettings();
$log = new Actionlog; $log = new Actionlog;
if($target != null){
$log->target_type = get_class($target); $log->target_type = get_class($target);
$log->target_id = $target->id; $log->target_id = $target->id;
}
if (static::class == LicenseSeat::class) { if (static::class == LicenseSeat::class) {
$log->item_type = License::class; $log->item_type = License::class;
$log->item_id = $this->license_id; $log->item_id = $this->license_id;