adiafora / revisionable-force-delete
Package improvement VentureCraft/revisionable
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=5.4.0
- illuminate/support: ~4.0|~5.0|~5.1|^6.0
- laravel/framework: ~5.4|^6.0
- venturecraft/revisionable: >=1.0
This package is auto-updated.
Last update: 2024-10-29 05:53:15 UTC
README
This package is an improvement on another package - Revisionable. You must install it before installing this package.
This package adds support for saving Force deleted models.
Install
Run:
composer require "adiafora/revisionable-force-delete"
Usage
Just add a trait RevisionableForceDeleteTrait
to the model whose revision you want to save.
use Adiafora\RevisionableForceDelete\RevisionableForceDeleteTrait;
Storing Force Delete
By default the Force Delete of a model is not stored as a revision.
If you want to store the Force Delete as a revision you can override this behavior by setting revisionForceDeleteEnabled
to true
by adding the following to your model:
protected $revisionForceDeleteEnabled = true;
In which case, the created_at
field will be stored as a key with the oldValue()
value equal to the model creation date and the newValue()
value equal to null
.
Attention! Turn on this setting carefully! Since the model saved in the revision, now does not exist, so you will not be able to get its object or its relations.