Edit this page


Versioning entry models is as easy as enabling it on your model using the $versionable property:

protected $versionable = true;

Saving revisions and what was changed will occur automatically now!

Temporarily Disabling Versioning

Should you need to temporarily disable versioning you can use the helper methods:


if ($entry->versioningDisabled()) {
    // Versioning is disabled.

Omitting Attributes From Versioning

To disable tracking of attributes from versioning you can use the nonVersionedAttributes property:

protected $nonVersionedAttributes = [

Accessing Versions

Versions can be fetched off the model instance you want to get versions for:

$current = $entry->getCurrentVersion();
$previous = $entry->getPreviousVersion();

foreach ($entry->getVersions() as $version) {
    $version->getVersion(); // The version ID

Accessing Model Data/Snapshots

You can grab the snapshot instance of the old model off the version instance using the model property:

$model = $version->getModel(); // Model Instance

You can grab only the data that was changed at that point with getData:

$changes = $version->getData(); // array