exertis / yii2-save-with-audit-trail-behavior
Adds a $model->saveWithAuditTrail() method to your Models allowing you to annotate changes to your data.
Installs: 250
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: >=2.0
This package is not auto-updated.
Last update: 2025-03-11 06:11:34 UTC
README
Adds a $model->saveWithAuditTrail() method to your Models allowing you to annotate changes to your data.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist exertis/yii2-save-with-audit-trail-behavior "*"
or add
"exertis/yii2-save-with-audit-trail-behavior": "*"
to the require section of your composer.json
file.
Database Setup
You need to run some migrations to setup the Audit Trail table.
php yii migrate --migrationPath=@vendor/exertis/yii2-save-with-audit-trail-behavior/migrations
Configuring
First you need to configure model as follows:
use exertis\savewithaudittrail\SaveWithAuditTrailBehavior; class Post extends ActiveRecord { public function behaviors() { return [ [ 'class' => SaveWithAuditTrailBehavior::className(), ], ]; } }