Download the PHP package rs/laravel-version-control without Composer
On this page you can find all versions of the php package rs/laravel-version-control. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rs/laravel-version-control
More information about rs/laravel-version-control
Files in rs/laravel-version-control
Package laravel-version-control
Short Description Foundations for making your app version controlled. Provides migration, blueprint and base models. Will make your app GxP compliant if you exclusively use the VC models and table structure as set out in this package.
License
Informations about the package laravel-version-control
Laravel Version Control
This package provides base models to use to make your app Version Control. It will also meet GxP compliance requirements.
Installation
If you wish to adjust the installation you can publish the assets
php artisan vendor:publish
to see publishing options, choose the appropriate option to publish this packages assets.
Migrations
You should setup your migrations to follow the migrations as seen in the tests/Fixtures/database/migrations files. For each model 2 tables will be created, the key (normal) table and the version history table.
Example migration
Note we are using are own custom Migration and Blueprint class. This will create 2 tables: The users table and a corresponding users_versions table. The 3rd parameter is optional and will fallback to the fields in the second parameter.
Version Control Models
Each model you create should extend the Redsnapper\LaravelVersionControl\Models\BaseModel
'Pivot' tables
Pivot table records are never destroyed. On creation they persist as records for the lifecycle of the project. Instead whenever a record is detached an active flag is switched to false.
Versions relationship
Versions can be accessed from models using the versions relationship.
Anonymize
To anonymize any field for any model pass an array of the fields to be anonymized as below.
This will create a new version for the action and will anonymize the fields passed. This will anonymize all versions attached to this model.