PHPackages                             vildanbina/laravel-versions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. vildanbina/laravel-versions

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vildanbina/laravel-versions
===========================

A Laravel package for managing model drafts.

1.0.0(1y ago)333.3k↑425%1MITPHPPHP &gt;=8.0

Since Oct 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/vildanbina/laravel-versions)[ Packagist](https://packagist.org/packages/vildanbina/laravel-versions)[ GitHub Sponsors](https://github.com/vildanbina)[ RSS](/packages/vildanbina-laravel-versions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/50eb3fbd2c219f93fab47542498e90874b2aadcc1b50fedc15d10a04e002e392/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d76657273696f6e732f76)](https://packagist.org/packages/vildanbina/laravel-versions)[![Total Downloads](https://camo.githubusercontent.com/5ec82716ea625b7677e25a3b740003cd7ee20e83189f132ac1bb39cec58b0d64/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d76657273696f6e732f646f776e6c6f616473)](https://packagist.org/packages/vildanbina/laravel-versions)[![Latest Unstable Version](https://camo.githubusercontent.com/14a56bb4b72743362aadbc5b83b85dec7ad87bad91bd70db5e3c7e3ac6730bf6/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d76657273696f6e732f762f756e737461626c65)](https://packagist.org/packages/vildanbina/laravel-versions)[![License](https://camo.githubusercontent.com/0674d3029ce54479159ff55f0140b274cdb128caaf513aa746ca462d11632149/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d76657273696f6e732f6c6963656e7365)](https://packagist.org/packages/vildanbina/laravel-versions)[![PHP Version Require](https://camo.githubusercontent.com/2f6aaad853bab51dc78148ab701a231b0003a010343d0378033c43f793ff1ab7/68747470733a2f2f706f7365722e707567782e6f72672f76696c64616e62696e612f6c61726176656c2d76657273696f6e732f726571756972652f706870)](https://packagist.org/packages/vildanbina/laravel-versions)

Laravel Versions
================

[](#laravel-versions)

**Laravel Versions** is a package that adds powerful draft and versioning capabilities to your Eloquent models. With this package, you can create drafts, manage versions, and publish changes to your models without affecting the currently published version. When a model is updated, it modifies the existing active draft instead of creating a new one for each change. If no active draft exists, a new one is created. Once you're ready, you can publish the draft to make it the active version while maintaining a history of all previous versions.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- Laravel 9.x, 10.x, or 11.x

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require vildanbina/laravel-versions
```

After installation, you need to publish the configuration file:

```
php artisan vendor:publish --provider="VildanBina\LaravelVersions\VersionsServiceProvider"
```

### Database Migrations

[](#database-migrations)

The package provides schema macros to add the necessary columns to your tables. You'll need to update your existing migrations or create new ones to add the drafts columns to your models' tables.

To add the drafts columns to a table (e.g., `posts`), you can use the `drafts()` macro in your migration:

```
