trex / yii-artimestamps
Timestamps created_at and updated_at with date format for ActiveRecord
Installs: 180
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii-component
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-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 ] ]; }