public function behaviors()
 {
     return ['timestamp' => ['class' => 'yii\\behaviors\\TimestampBehavior', 'attributes' => [self::EVENT_BEFORE_INSERT => ['create_time']], 'value' => function () {
         return new Expression('CURRENT_TIMESTAMP');
     }], 'blamea' => ['class' => BlameableBehavior::className(), 'createdByAttribute' => 'create_by', 'updatedByAttribute' => false], 'ip' => ['class' => IpBehavior::className(), 'attributes' => [self::EVENT_BEFORE_INSERT => ['ip']]]];
 }
Esempio n. 2
0
 public function behaviors()
 {
     return array_merge(parent::behaviors(), ['timestamp' => ['class' => 'yii\\behaviors\\TimestampBehavior', 'attributes' => [self::EVENT_BEFORE_INSERT => ['create_time', 'update_time'], self::EVENT_BEFORE_UPDATE => ['update_time']], 'value' => function () {
         return new Expression('CURRENT_TIMESTAMP');
     }], 'blameable' => ['class' => BlameableBehavior::className(), 'createdByAttribute' => 'create_by', 'updatedByAttribute' => false], 'attachments' => ['class' => \nemmo\attachments\behaviors\FileBehavior::className()], 'ip' => ['class' => IpBehavior::className(), 'attributes' => [self::EVENT_BEFORE_INSERT => ['ip']]]]);
 }