addBehavior( new SoftDelete([ 'field' => 'deleted', 'value' => 1, ]) ); } public function beforeCreate() { $this->create_time = time(); } public function beforeUpdate() { if ($this->deleted == 1) { $this->published = 0; } $this->update_time = time(); } public static function posTypes() { return [ self::POS_TOP => '顶部', self::POS_BOTTOM => '底部', ]; } public static function targetTypes() { return [ self::TARGET_BLANK => '新窗口', self::TARGET_SELF => '原窗口', ]; } }