-
-
Notifications
You must be signed in to change notification settings - Fork 718
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
[FEATURE/QUESTION] Be able to have batches of activity logs/set causer for a duration #560
Comments
This question consists of two parts.
Also something to cover would be conflicting batches.
To which batch should the product-variants activities belong? Or should this throw an exception because of an already set batch? Or should the second batch create some kind of sub-batch like I'm open for this feature but it's implementation should cover a lot of cases and be customizable to mix it up with any custom needs. My most favorite implementation would be something like the ActivityLogger::useBatch(function () {
activity()->log('my message');
$product->delete();
}); This would start a new batch, assign all activities created during the callback to the batch and end the batch after the callback. Would these three methods cover your needs? |
The first of setting the causer from an extended Logger class....seems straightforward and I'm not really sure why I didn't just do that in the first place. The second around handling batches, I like the idea of sticking to a familiar callback style like transactions do. If I were to submit this I would probably just simplify the handling of the batches and if there was a nested batch that started, it would be treated like the outer batch in the case of linking them. |
Ok, and would you more like an exception if a second batch is started inside another one? Or should it quit silently and just run in the first batch? |
✅ Add tests
✅ Add tests
I will close this issue even if v4 isn't released yet. But the task itself is done and I want to check which tasks are really open. Please keep an eye on #787 |
Not sure if this would be related to #503, but I was wondering if there was any interest in being able to "batch" activity logs, like in automated changes, perhaps a user makes many changes that can be linked back to a single actitivity.
For example,
User deletes an author, then that cascades soft deletes to the books for that author.
Having a way to link those changes as being related would be very very useful IMHO.
Additionally, since something like this would be great to have in case of background actions, maybe have a way to set the causer for the duration of some subset of logging? That way you can link activity logs to a user, but then also link all related changes to the original that started it all, while also being able to set a causer like in my example, knowing that the user specifically didn't trigger the soft delete on books, but that was caused by the author model.
That's all sort of convoluted, but I wanted to see if anyone else had some need for something like this.
The text was updated successfully, but these errors were encountered: