How to implement Laravel-Auditing to bulk CRUD operations and multiple model operations #1029
Unanswered
jericho-yu-llanes
asked this question in
Q&A
Replies: 1 comment 1 reply
-
This package relies on model events, you would have to write something incredibly complicated in order to match it without using the model events so I would say definitely easier to use chunkById to apply your changes directly to the models (and so have the events fired). I don't think there is a grouping in the package currently but presumably there is nothing stopping you adding a column and perhaps using laravel context or a session value to group changes per request with a small change to the trait. Mostly I tend to group things by time, url, or user to pin the blame on a certain process. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone 👋
I'm currently working on a Laravel project where I use the
laravel-auditing
package to log changes to models. It's working great for single record operations likecreate
,update
, anddelete
.However, I’m now facing a challenge on how to best implement auditing when performing:
update()
ordestroy()
on a query builder.User
, creating relatedProfile
, and deleting somePermissions
all within one action.Questions:
Context:
Any advice, examples, or implementation patterns would be greatly appreciated 🙏
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions