Yii2 History Extension
An active record history extension for yii2, (*1)
Installation
1.Download
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
composer require atans/yii2-history
or add, (*4)
"atans/yii2-history": "*"
to the require section of your composer.json
file., (*5)
Then run, (*6)
composer update
2.Update database schema
$ php yii migrate/up --migrationPath=@vendor/atans/yii2-history/migrations
Usage
namespace frontend\models\User;
class User extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public function behaviors()
{
return [
'history' => [
'class' => \atans\history\behaviors\HistoryBehavior::className(),
// Options
'allowEvents' => [..],
'ignoreFields' => [...],
'extraFields' => [...],
'debug' => true, // Show the errors
],
];
}
}