Revisionable: package to log who did what and when in Laravel Models
A short review of a package which is hugely popular but I've found it only recently. Quite a useful case - if you want to log all the changes to your data - who changed what and when, it's pretty simple with Revisionable.
The usage is pretty simple:
Install the package
Run its migrations - basically it's one table called "revisions"
Add some code into a model you want to "follow"
Here's my example of Model:
class Book extends Model
protected $fillable = ['title', 'description'];
public static function boot()
And basically, that's it. Whenever someone updates a database entry with Eloquent, like this:
You will get a new entry in database table revisions.
And then you can create a separate view to show that log more conveniently.
Of course, there are a lot of additional settings and functionality, like for example:
History limit = X. Stop tracking revisions after 500 changes have been made
$revisionCleanup = true; //Remove old revisions (works only when used with $historyLimit)
No comments or questions yet...