Skip to content

Commit bf2c637

Browse files
authored
Fix blacklist empty values issue(#32)
1 parent eb380fe commit bf2c637

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/HistoryObserver.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,18 @@ public function updating($model)
4444
* Bypass restoring event
4545
*/
4646
if(array_key_exists('deleted_at', $changes)) return;
47+
/**
48+
* Get meta values that will be stored
49+
*/
50+
$meta = $model->getModelMeta('updating');
51+
/**
52+
* Bypass updating event when meta is empty
53+
*/
54+
if (!$meta) return;
4755

4856
$model->morphMany(History::class, 'model')->create([
4957
'message' => trans('panoscape::history.updating', ['model' => static::getModelName($model), 'label' => $model->getModelLabel()]),
50-
'meta' => $model->getModelMeta('updating'),
58+
'meta' => $meta,
5159
'user_id' => static::getUserID(),
5260
'user_type' => static::getUserType(),
5361
'performed_at' => time(),

0 commit comments

Comments
 (0)