Description
Laravel Rewind is a powerful and efficient versioning package for your Eloquent models.
Navigating History
use AvocetShores\LaravelRewind\Facades\Rewind; // Step backward/forwardRewind::rewind($post, 2); // Go back 2 versionsRewind::fastForward($post); // Go forward 1 version // Jump to a specific versionRewind::goTo($post, 5); // Get the model's state at a specific point in time$attributes = Rewind::versionAt($post, Carbon::parse('2025-01-15 14:30:00'));
Restoring State
There are two ways to go back to a previous version, and the distinction matters:
goTo() moves the pointer. The model is updated to match the target version, but no new version record is created. Good for previewing or navigating.
restore() creates a new version with the target version's state. The history shows the restore happened. Good for audit trails and compliance.
// Move the pointer (no audit trail of the move itself)Rewind::goTo($post, 3); // Create a new version from v3's state (audit trail preserved)Rewind::restore($post, 3);// $post is now at v8 (or whatever the next version is), with v3's attributes// The version record has event_type 'restored' and meta['restored_from_version'] = 3
Recent Courses on Laravel Daily
AI Agents/IDEs for Laravel: May 2026 (Claude Code, Codex, OpenCode, etc)
7 lessons
52 min
Next.js Basics for Laravel Developers
11 lessons
58 min
Roles and Permissions in Laravel 13
14 lessons
57 min