trex / yii-artimestamps
该软件包最新版本(dev-master)没有提供许可信息。
为ActiveRecord创建的具有日期格式的created_at和updated_at时间戳
dev-master
2017-12-23 10:55 UTC
Requires
- php: >=5.4.0
- yiisoft/yii2: ~2.0.5
Requires (Dev)
- codeception/base: ^2.2.3
- codeception/specify: ~0.4.3
- codeception/verify: ~0.3.1
- yiisoft/yii2-debug: ~2.0.0
- yiisoft/yii2-faker: ~2.0.0
- yiisoft/yii2-gii: ~2.0.0
This package is not auto-updated.
Last update: 2024-09-29 03:04:29 UTC
README
为ActiveRecord创建的具有日期格式的created_at和updated_at时间戳
安装
通过composer
composer require trex/yii-artimestamps
或者在您的composer.json文件中添加以下行
"trex/yii-artimestamps": "*"
用法
1. 在您的表中添加create列和update列
2. 在您的ActiveRecord中添加行为
public function behaviors() { return [ "timestamp" => [ 'class' => \trex\yii\artimestamps\TimestampBehavior::className(), 'createdAtField' => '{{ my create field }}', 'updatedAtField' => '{{ my update field }}', 'format' => 'Y-m-d H:i:s' //this is optional ] ]; }