t-kanstantsin / yii2-author-behavior
为Yii 2框架提供的作者行为。
dev-master / 1.0.x-dev
2015-12-23 23:59 UTC
Requires
- php: >=5.5.0
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-14 19:36:35 UTC
README
行为代表类似于yii\db\TimestampBehavior的附加功能,但会自动填充指定的属性,以当前用户ID或value
字段中定义的值。
安装
安装此扩展的首选方式是通过composer。
运行以下命令之一
$ php composer.phar require --prefer-dist t-kanstantsin/yii2-author-behavior "*"
或
"t-kanstantsin/yii2-author-behavior": "*"
将以下内容添加到您的composer.json
文件的require部分。
使用方法
行为配置示例
// in `behaviors` method [ 'class' => tkanstantsin\yii2\behaviors\AuthorBehavior::class, 'createdByAttribute' => 'created_by_id', 'updatedByAttribute' => 'updated_by_id', ],
致谢
许可证
BSD许可证(BSD)。有关更多信息,请参阅许可证文件。