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() { $cache = new NavTreeListCache(); $cache->rebuild(); } public static function positionTypes() { $list = [ self::POSITION_TOP => '顶部', self::POSITION_BOTTOM => '底部', ]; return $list; } public static function targetTypes() { $list = [ self::TARGET_BLANK => '新窗口', self::TARGET_SELF => '原窗口', ]; return $list; } }