F
Filamentβ€’17mo ago
Oddman

How would you support record versioning?

I have a few ideas how to support this, but wondering if anyone is aware of a plugin or a way to do this that maybe I haven't thought of?
Solution:
#pxlrbt-activity-log ?
Jump to solution
14 Replies
Solution
Dennis Koch
Dennis Kochβ€’17mo ago
#pxlrbt-activity-log ?
Oddman
OddmanOPβ€’17mo ago
That's a cool plugin, will definitely add that, but no, not what I'm after πŸ™‚ Basically, if I have an article I'm editing, I want every new save to create a new version of that article, and to be able to revert to a previous version, if necessary. It's relatively easy to solve, just keep a log of all edits, in full json, and be able to revert back to a previous version. Doesn't need to show the differences between versions, although if I can query the activity log... maybe that's enough? πŸ€”
Dennis Koch
Dennis Kochβ€’17mo ago
You could do the same with spatie/activity-log. I am happy to add a revert option to my package if someone PRs. But if you don’t want to see the changes maybe that’s overkill
Oddman
OddmanOPβ€’17mo ago
I'll give it a go anyway, see what happens. The main areas that would change, would be the content builder field, which could get verbose. hahaha Thanks, @Dennis Koch !
toeknee
toekneeβ€’17mo ago
That's exactly what I built in πŸ™‚ Just need to do a PR with the condition for the revert @.oddman I've coded up the restore function and made a PR πŸ™‚ So it will be available soon! I was previously using the Versionable by overtune, but this ends up extremely heavy on the old db with a few mill records. Using spatie activity log helps keep things light πŸ˜„
Dennis Koch
Dennis Kochβ€’17mo ago
Versionable stores full copies then with a "revision"?
toeknee
toekneeβ€’17mo ago
It does and it's heavy, it has it's use cases for sure. But not for everything πŸ™‚ , this is where this restore functionality allows a leaner and inbetween bridge.
Oddman
OddmanOPβ€’17mo ago
Dude that's amazing!!!!. I'll be sure to install then πŸ™‚ Is it possible to create an action or something on a form that allows me to view recent versions, and then select one to revert to?
toeknee
toekneeβ€’17mo ago
Yeah, add an action to link to the page. If you want a model then you can, just render the page
Oddman
OddmanOPβ€’17mo ago
Modal works too I guess. I was thinking more like a side section in the form.
toeknee
toekneeβ€’17mo ago
You could use an action slideOver() so it pulls out from the right too. which just renders the activities page view I support
Oddman
OddmanOPβ€’17mo ago
But I can definitely query just for the content specific to that page?
toeknee
toekneeβ€’17mo ago
Of course, see how the activities is done, in theroy you can just copy the code we have done for the activities page and include it in your edit page
Oddman
OddmanOPβ€’17mo ago
Awesome, thanks @toeknee_iom πŸ™‚
Want results from more Discord servers?
Add your server