Skip to content

Commit

Permalink
Fix blacklist empty values issue(#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusKurten committed Jun 2, 2023
1 parent eb380fe commit bf2c637
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/HistoryObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ public function updating($model)
* Bypass restoring event
*/
if(array_key_exists('deleted_at', $changes)) return;
/**
* Get meta values that will be stored
*/
$meta = $model->getModelMeta('updating');
/**
* Bypass updating event when meta is empty
*/
if (!$meta) return;

$model->morphMany(History::class, 'model')->create([
'message' => trans('panoscape::history.updating', ['model' => static::getModelName($model), 'label' => $model->getModelLabel()]),
'meta' => $model->getModelMeta('updating'),
'meta' => $meta,
'user_id' => static::getUserID(),
'user_type' => static::getUserType(),
'performed_at' => time(),
Expand Down

0 comments on commit bf2c637

Please sign in to comment.