Knowledge Base

Empty filter

Laravel Rewind is a Versioning Package for Eloquent

Laravel Rewind is a powerful and efficient versioning package for your Eloquent models created by Jared Cannon. This package stores a combination of partial diffs and full snapshots of your model data. Rewind will automatically determine the shortest path between the current version, available snapshots, and your target:

// Previous title: 'Old Title'
$post->title = 'New Title';
$post->save();

// Title goes back to 'Old Title'
Rewind::rewind($post);

$post->title = 'Rewind is Awesome!';
$post->save();
To enable version tracking on a model, you simply require the Rewindable trait on a model:

use AvocetShores\LaravelRewind\Concerns\Rewindable;

class Post extends Model
{
use Rewindable;
}
#Main Features
Rewind to a specific version
Fast-forward one or multiple versions
Move a model to a specific version
Thread safety to prevent model overwrites
Exclude attributes from versioning
Build attributes from a specific version
Clone a model at a specific version
And more...
For more details, visit the laravel-rewind GitHub repository and explore its extensive documentation and examples. You can install this package with Composer, using the following command:

composer require avocet-shores/laravel-rewind

php artisan vendor:publish --provider="AvocetShores\LaravelRewind\LaravelRewindServiceProvider"

php artisan migrate

Published
Back to Index