ActivityLog add log fields added on created and duplicated
This commit is contained in:
parent
02319ee46a
commit
66d52ebe5b
1 changed files with 6 additions and 2 deletions
|
|
@ -111,8 +111,12 @@ class ActivityLog extends Model
|
|||
->map(fn ($value) => self::getValueType($value))
|
||||
->toArray();
|
||||
/** Return old, new and type of values changed */
|
||||
return ($eventEnum === ActivityLogsEventEnum::updated) ?
|
||||
array_intersect_key($targetModelTypes, $model->getChanges()) : [];
|
||||
return match ($eventEnum) {
|
||||
ActivityLogsEventEnum::created => array_intersect_key($targetModelTypes, $model->toArray()),
|
||||
ActivityLogsEventEnum::duplicated => array_intersect_key($targetModelTypes, $model->toArray()),
|
||||
ActivityLogsEventEnum::updated => array_intersect_key($targetModelTypes, $model->getChanges()),
|
||||
default => []
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue