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:

namespace App;

use Illuminate\Database\Eloquent\Model;

class Book extends Model
    use \Venturecraft\Revisionable\RevisionableTrait;

    protected $fillable = ['title', 'description'];

    public static function boot()


And basically, that’s it. Whenever someone updates a database entry with Eloquent, like this:

    $book = \App\Book::find(1);
    $book->update(['title' => 'bbb']);

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)
  • Storing soft deletes
  • Storing creations or not

In general, a really good package by Chris Duell. And I recommend you read full documentation on Github page here – a lot of interesting small things there.

Update: there’s another similar package by Marcel Pociot – called Versionable – check it out too.

Like our articles?
Check out our Laravel online courses!



Please enter your comment!
Please enter your name here