atans / yii2-history
yii2 的活动记录历史
1.0.1
2017-03-30 09:52 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-13 23:16:13 UTC
README
yii2 的活动记录历史扩展
安装
1. 下载
安装此扩展的首选方法是通过 composer。
运行以下命令之一
composer require atans/yii2-history
或者
"atans/yii2-history": "*"
将以下内容添加到您的 composer.json
文件的 require 部分。
然后运行
composer update
2. 更新数据库模式
$ php yii migrate/up --migrationPath=@vendor/atans/yii2-history/migrations
用法
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 ], ]; } }