Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated attribute not being flagged as dirty #1297

Open
FrancisMawn opened this issue Apr 24, 2024 · 0 comments
Open

Updated attribute not being flagged as dirty #1297

FrancisMawn opened this issue Apr 24, 2024 · 0 comments
Labels

Comments

@FrancisMawn
Copy link
Contributor

Describe the bug
Let's say we have a User model with a "code" attribute.
Updating $user->code from '001' to '01' will not get logged when using the logOnlyDirty() method.
NOTE: This is not a configuration issue as everything else works as expected.

To Reproduce

  • Configure a model to only log dirty attributes
return LogOptions::defaults()
            ->logOnlyDirty()
            ->dontSubmitEmptyLogs();
  • Set a string attribute with digits (i.e. "123456")
  • Update the attribute to add leading zero(s) (i.e. "0123456")
  • No activity logs are created

Expected behavior
Since the model attribute has changed, I would expect an activity log to be created.

Versions (please complete the following information)

  • PHP: 8.3.4
  • Database: MySQL 8
  • Laravel: 10.48.4
  • Package: spatie/laravel-activitylog 4.8.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant