Created
December 31, 2014 17:09
-
-
Save evercode1/a88e938a5ee34dc3b209 to your computer and use it in GitHub Desktop.
Behaviors Chap 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * behaviors | |
| */ | |
| public function behaviors() | |
| { | |
| return [ | |
| 'timestamp' => [ | |
| 'class' => 'yii\behaviors\TimestampBehavior', | |
| 'attributes' => [ | |
| ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], | |
| ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], | |
| ], | |
| 'value' => new Expression('NOW()'), | |
| ], | |
| ]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment