Feature Proposal: revision history
So, I've been thinking about @taylorotwell's approach of removing the painful aspects of development through the framework and I am working on this problem and thought that it might be relevant.
I have content that has to have revision history. I can't lose old versions. In addition, I need to be able to pull a draft version and a published version. These also need to maintain native Eloquent relationships.
I'd personally like to see these problems resolved within the framework, like soft-deletes.
I believe that it might be ubiquitous enough a need and might require specific enough an implementation to Eloquent to warrant not just being a package.
In addition, I think that (like soft-deletes, migrations, unit-testing, etc) if this is easy to implement within the framework then more people would use it when the opportunity arose.
It's definitely something that would come in very handy for a lot of situations.
There are some packages out there already that offer some of the functionality that you're suggesting that may be worth checking out. https://github.com/VentureCraft/revisionable extends Eloquent for example.
There was a blog post I read a while back about achieving a similar thing, but I can't manage to find it. I guess it shows that there is definitely a desire for it in the community at least.
The fact that Laravel already provides solf-deletes suggests to me that this may be a feature that isn't out of the scope of being included in the framework itself.
I like it.
I think it's a good idea too :+1:
I like it!
Certainly a feature I'd use.
At the company where I work we have been building a feature like this but for very narrow application, I wish something like this was built in though, it would've saved us hours upon hours.
What would this involve? something like Git inside of the DB (that would only record the differences) or something that would blindly copy the whole content from row to row?
+1 from me, definitely very useful
:+1: from me. This is a often needed use-case. We are also currently using the revisionable package from VentureCraft.
+1, definitely.
I second msurguy's curiosity about implementation. Back when I had to use Joomla for a few client sites, we utilized a third-party extension called "Versions" that kept simple revisions of the content. The interface was kludgy (it just listed all of the previous versions as links, and if you clicked them it'd apply that version to your article content). The architecture was more so (rather than soft-deleting versions of the content it actually just stored complete versions of the old content in a new table). Ideally I think it'd be more interesting to store diffs when they're made, but I don't know Laravel well enough to say whether that's a sound architectural decision given the way the data model works. If nothing else I'd love to see implementation of it in-framework if for no other reason than to see how that's approached philosophically from the Eloquent perspective.
Definitely on board for that.
another +1
You know part of me is toying with the idea of this being a trait. Has anyone looked into doing something like that? Perhaps as a community package?
I just wanted to add this here. Someone made something relevant for Laravel 3. https://github.com/Aboalarm/Versions-for-Laravel
I'm currently working on version control, but I'm doing it within the database. I would love reversion with laravel. But on the other hand it made has a better place in database, doesn't it? This way all the data logic is in one place.
Will leave this up to package land.