trex/yii-artimestamps

该软件包最新版本(dev-master)没有提供许可信息。

为ActiveRecord创建的具有日期格式的created_at和updated_at时间戳

安装: 183

依赖: 0

建议: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii-component

dev-master 2017-12-23 10:55 UTC

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
        ]
    ];
}