PHPackages                             act-training/laravel-model-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. [Database &amp; ORM](/categories/database)
4. /
5. act-training/laravel-model-versions

ActiveLibrary[Database &amp; ORM](/categories/database)

act-training/laravel-model-versions
===================================

A Laravel package for automatic model versioning with selective attribute tracking and restore capabilities

v1.0.1(7mo ago)0245MITPHPPHP ^8.3CI failing

Since Sep 29Pushed 7mo agoCompare

[ Source](https://github.com/ACT-Training/laravel-model-versions)[ Packagist](https://packagist.org/packages/act-training/laravel-model-versions)[ RSS](/packages/act-training-laravel-model-versions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (4)Used By (0)

Laravel Model Versions
======================

[](#laravel-model-versions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/face5e370563a63f0e817c23d4db254bf625e96b07085c666d3441fcf4d301aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6163742d747261696e696e672f6c61726176656c2d6d6f64656c2d76657273696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/act-training/laravel-model-versions)[![Total Downloads](https://camo.githubusercontent.com/8147f6965e744374a22abca12751384296c7d84d2bef1f54c672fe580fa98b62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6163742d747261696e696e672f6c61726176656c2d6d6f64656c2d76657273696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/act-training/laravel-model-versions)

A Laravel package for automatic model versioning with selective attribute tracking and restore capabilities. Track changes to your Eloquent models with complete version history, restore to previous versions, and maintain a complete audit trail.

Features
--------

[](#features)

- 🚀 **Automatic Versioning**: Automatically create versions when models are created or updated
- 🎯 **Selective Versioning**: Choose which attributes to version using `versionableAttributes` or `nonVersionableAttributes`
- ⏪ **Version Restoration**: Restore models to any previous version with a single method call
- 👤 **User Tracking**: Automatically track which user created each version
- 💬 **Version Comments**: Add comments to versions for better change tracking
- ⚙️ **Configurable**: Extensive configuration options to fit your needs
- 🧪 **Well Tested**: Comprehensive test suite with 100% code coverage
- 🔒 **Temporary Disabling**: Disable versioning temporarily when needed

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

[](#installation)

You can install the package via composer:

```
composer require act-training/laravel-model-versions
```

Publish and run the migrations:

```
php artisan vendor:publish --provider="ActTraining\LaravelModelVersions\LaravelModelVersionsServiceProvider" --tag="model-versions-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --provider="ActTraining\LaravelModelVersions\LaravelModelVersionsServiceProvider" --tag="model-versions-config"
```

Quick Start
-----------

[](#quick-start)

Add the `HasVersions` trait to your model:

```
