Skip to content

Commit

Permalink
Merge pull request #1525 from suraj-webkul/logactivity-traits
Browse files Browse the repository at this point in the history
update activity log traits.
  • Loading branch information
jitendra-webkul committed Aug 29, 2024
2 parents 066ab35 + bf46c7c commit 3e274aa
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/Webkul/Activity/src/Traits/LogsActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ private static function logActivity($model)
'attribute' => $attributeCode,
'new' => [
'value' => $attributeData['new'],
'label' => app(AttributeValueRepository::class)->getAttributeLabel($attributeData['new'], $model->attribute),
'label' => self::getAttributeLabel($attributeData['new'], $model->attribute),
],
'old' => [
'value' => $attributeData['old'],
'label' => app(AttributeValueRepository::class)->getAttributeLabel($attributeData['old'], $model->attribute),
'label' => self::getAttributeLabel($attributeData['old'], $model->attribute),
],
]),
'user_id' => auth()->id(),
Expand All @@ -97,6 +97,14 @@ private static function logActivity($model)
}
}

/**
* Get attribute label.
*/
private static function getAttributeLabel($value, $attribute)
{
return app(AttributeValueRepository::class)->getAttributeLabel($value, $attribute);
}

/**
* Create activity.
*/
Expand Down

0 comments on commit 3e274aa

Please # to comment.