ActivityLog - EntryModel - multiple-field_typeCreated 5 years ago by girvydas
I have a problem while integrating activity-log package (https://github.com/spatie/laravel-activitylog). It is not detecting relationship type changes (then using multiple-field_type) First of all, Streams EntryModel toArray method should return values like parent method (with relationToArray() method). Second problem happens then package is trying to get EntryModel via $this->fresh() method. Right after save, new values are not yet saved. My guess that there is some compatibility problems with Eloquent sync() method line - (https://github.com/anomalylabs/multiple-field_type/blob/61aa6e25c24dde6da5df41942af651abe1195a42/src/MultipleFieldTypeAccessor.php#L48).
Any thoughts how to implement relation changes? 😄
Simple situation using "spatie/laravel-activitylog": At "Anomaly\UsersModule\User\UserModel" use "LogsActivity" trait and add: protected static $logAttributes = [ 'first_name', 'roles', ]; protected static $logOnlyDirty = true;
After these changes, when updating user entry it logs only first name.
I had quite same problem with other functionality where I wanted to access fresh created entry relationship value, but it was not yet saved, so I had to use queued jobs to solve that problem..
toArraynot return ANY relation information?
If you have a repo you would be willing to share - I could look at it. Otherwise I suppose I could install it myself too 😄
Would be nice to see something like this available to Pyro though. Ill check it out.