rmsramos/activitylog

logOnlyDirty() is not working

dharen008 opened this issue · 1 comments

Package Version

3.1

Laravel Version

11

PHP Version

8.2

Problem description

logOnlyDirty is not working

public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->logOnlyDirty();
}

Expected behavior

it should only log the changed data only, but instead property is having []/empty value in the database instead

Steps to reproduce

on my repository i use the user model as an example. please try to check it. thanks!

Reproduction repository (issue will be closed if this is not valid)

https://github.com/dharen008/demo

Relevant log output

No response

Sorry my code is incorrect, it should be like this to make it work

public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
->setDescriptionForEvent( fn( string $eventName ) => "{$this->name} has been {$eventName}" )
->logOnlyDirty()
->logFillable();
}