Download the PHP package makidizajnerica/laravel-snapshoter without Composer
On this page you can find all versions of the php package makidizajnerica/laravel-snapshoter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download makidizajnerica/laravel-snapshoter
More information about makidizajnerica/laravel-snapshoter
Files in makidizajnerica/laravel-snapshoter
Package laravel-snapshoter
Short Description Laravel model snapshoter.
License MIT
Homepage https://github.com/MakiDizajnerica/laravel-snapshoter
Informations about the package laravel-snapshoter
Laravel Snapshoter
Laravel model snapshoter. Make snapshots for the models, revert model state to previous snapshot.
Installation
After that be sure to run migrations to generate snapshots
table:
Then publish config file snapshoter.php
using:
Usage
Your model needs to implement MakiDizajnerica\Snapshoter\Contracts\Snapshotable
and also to use MakiDizajnerica\Snapshoter\HasSnapshots
trait. Next define snapshotFields
method that will return model attributes you want to save to the snapshots:
You will then have some methods available on your model:
If you want to create, update or save your model with the snapshot, you can use:
Another option would be to use observer and automatically make snapshot on model create or update:
Author
Nemanja Marijanovic ([email protected])
Licence
Copyright © 2021, Nemanja Marijanovic [email protected]
All rights reserved.
For the full copyright and license information, please view the LICENSE file that was distributed within the source root of this package.