type = "default"; $op->value = $value; $op->label = $label; return $op; } /** * @param CascaderOption[] $children * @return $this */ public function children($children) { $this->children = $children; return $this; } /** * @param bool $leaf * @return $this */ public function leaf($leaf=true) { $this->leaf = $leaf; return $this; } public function jsonSerialize():array { $data = []; foreach ($this as $key => $val) { if (!empty($val)) $data[$key] = $val; } return $data; } }