add("product_id", Field::HIDDEN); $this->add("name", Field::TEXT, ["label" => "名称", "rules" => "required"]); $this->add("used_for_fee", Field::SELECT, ["label" => "与管理费挂钩", "choices" => [ "0" => "不挂钩", "1" => "挂钩" ]]); $this->add('factorItems', 'collection', [ 'type' => 'form', 'label' => "型号选择", 'options' => [ 'class' => 'App\Forms\FactorItemForm', 'label' => false ] ]); $this->add("myindex", Field::NUMBER, ["label" => "排序", "rules" => "required", "default_value" => 0]); $this->add('buttons', 'buttongroup', ["splitted" => true, "buttons" => [ ["label" => "保存", "attr" => ["class" => "btn btn-primary mr-1", "type" => "submit"]], ["label" => "返回", "attr" => ["class" => "btn btn-light btn-back", "type" => "button"]] ]]); } }