laravel-model-revision maintained by pilyavskiy
Laravel model revision package
Install
composer require pilyavskiy/laravel-model-revision
Usage
To start using revisions for a model, you need to run a command, where Example is the base model.
php artisan make:model-revision Example
After executing the command, a revision model ExampleRevision and a migration for the revision will be created.
! Important
The revision model needs:
- the
$fillableproperty needs to be filled in - the base model fields need to be added to the migration.
! Important
The base model must:
- Extends
Pilyavskiy\ModelRevision\Models\ModelRevisionor usePilyavskiy\ModelRevision\Trait\Revision - The
$revisionproperty is filled with the path to the revision model.
public string $revision = \App\Models\Revisions\ExampleRevision::class;