trex/yii-artimestamps

There is no license information available for the latest version (dev-master) of this package.

Timestamps created_at and updated_at with date format for ActiveRecord

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

This package is not auto-updated.

Last update: 2024-05-12 00:41:18 UTC


README

Timestamps created_at and updated_at with date format for ActiveRecord

Instalation

Via composer:

composer require trex/yii-artimestamps

or add this lines in your composer.json:

"trex/yii-artimestamps": "*"

Usage

1. Add a create column and update column in your table

2. Add the behavior in your 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
        ]
    ];
}