Logging relationships in convenient way #973
Replies: 2 comments 1 reply
-
Hey, that it worked before wasn't an intended feature or supported usage. But let's start at the beginning - could you send in a full code example/testcase of your wanted behavior? As I have an idea of your usage but am not sure if I got it right. And having a real testcase that should get green is always the best way to check if the feature request was solved. 😉 But to be clear: the official wanted/expected way are the log batches. If there's something we could do to make them more accessible/useful let me know. |
Beta Was this translation helpful? Give feedback.
-
@shortcodes how did you manage this to work? i have the same issue when changing a (spatie-pemissions) role for a user, the change is not caught but should be linked to the |
Beta Was this translation helpful? Give feedback.
-
Hey. At the beginning I would like to say its great package! But unfortunately
v4
version messed things up for me when it comes to conveniently logging model relationship. I did not use this package for quite time and now when I pull it out of the hat it behaves differently.First of all I need to explain what is convenient way in my concept. It is to see every all changes on model and its relations in one place (in one row in database) without using batches or another new inventions. What I would like to achieve is JSON chain which looks like this:
While creating objects
Above example is easily achievable.
When updating objects
Above example which extract
role
relation is achievable only if any of object base properties changes. So situation described above can't happen. To do this there is a necessity to flint some dirty solutions like touching etc.All that because in
v4
of this package collection of$old
attributes was limited only toupdating
event which is not being fired if I use observers for modify relations while updating object (but not actually touching object)Changes in current version of package I needed to modify are not substantial:
And
This way I can have it all inside properties JSON in one way (whatever is in fillable even many to many relations) when changing it via observers or commands or action etc.
Do you recall if this can be achieved with unmodified version of this package? Did I miss it in documentation? Or should I write PR to attach this to this great package?
Kind Regards!
Beta Was this translation helpful? Give feedback.
All reactions