We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8f94ffc + d621f3c commit a5ac38fCopy full SHA for a5ac38f
1 file changed
src/Traits/HasLog.php
@@ -42,13 +42,18 @@ public static function boot()
42
*/
43
static::updated(function ($model) {
44
if (auth()->check()) {
45
+ $excluded = $model->hidden ?? [];
46
+
47
+ $old = collect($model->getRawOriginal())->except($excluded)->toArray();
48
+ $changes = collect($model->getChanges())->except($excluded)->toArray();
49
50
$model->logs()->create([
51
'action' => 'Update',
52
'ip_address' => request()->ip(),
53
'device' => request()->userAgent(),
54
'user_id' => auth()->user()->id,
- 'old_data' => json_encode($model->getRawOriginal()),
- 'changed_values' => json_encode($model->getChanges())
55
+ 'old_data' => json_encode($old),
56
+ 'changed_values' => json_encode($changes),
57
]);
58
}
59
});
0 commit comments