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?
14 Replies
Solution
#pxlrbt-activity-log ?
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? π€
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
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 !
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 π
Versionable stores full copies then with a "revision"?
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.
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?
Yeah, add an action to link to the page.
If you want a model then you can, just render the page
Modal works too I guess. I was thinking more like a side section in the form.
You could use an action slideOver() so it pulls out from the right too. which just renders the activities page view I support
But I can definitely query just for the content specific to that page?
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
Awesome, thanks @toeknee_iom π