<?php
/**
 * Created by PhpStorm.
 * User: xiaofeng
 * Date: 2018/4/10
 * Time: 上午10:20
 */

namespace common\models;

use yii\db\ActiveRecord;
use yii\behaviors\TimestampBehavior;
class TinypngRecord extends ActiveRecord
{
    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::className(),
                'attributes' => [
                    # 创建之前
                    ActiveRecord::EVENT_BEFORE_INSERT => ['create_at'],
                    # 修改之前
//                    ActiveRecord::EVENT_BEFORE_UPDATE => ['update_at']
                ],
                #设置默认值
                'value' => $_SERVER['REQUEST_TIME']
            ]
        ];
    }


}