addBehavior( new SoftDelete([ 'field' => 'deleted', 'value' => 1, ]) ); } public function beforeCreate() { $this->created_at = time(); } public function beforeUpdate() { $this->updated_at = time(); } public function afterCreate() { $this->rebuildCache(); } public function afterUpdate() { $this->rebuildCache(); } public function rebuildCache() { $navListCache = new NavListCache(); $navListCache->rebuild(); } public static function positions() { $list = [ self::POSITION_TOP => '顶部', self::POSITION_BOTTOM => '底部', ]; return $list; } public static function targets() { $list = [ self::TARGET_BLANK => '新窗口', self::TARGET_SELF => '原窗口', ]; return $list; } }