We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
protected function form() { return Form::make(new ShopGood(), function (Form $form) { $form->title('商品'); $formStep = $form->multipleSteps(); $formStep->add('商品分类', function ($step) { $step->tree('type_id') ->nodes(ShopType::get()->toArray()) ->setIdColumn('id') ->setTitleColumn('title') ->setParentColumn('pid') ->customFormat(function ($v) { // 格式化外部注入的值 if (!$v) return []; return array_column($v, 'id'); })->required(); }); $formStep->add('商品基本信息', function ($step) { $step->text('title')->required(); $step->weditor('body')->required(); $step->select('sku_type')->options(Model::nodeSkuTypeSelect())->default(1) ->when([1], function ($step) { $step->currency('price'); })->when([2], function ($step) { $sku_params = [ [ 'name' => '进货价', 'field' => 'price_buy', 'default' => '', ], [ 'name' => '市场价', 'field' => 'price_mark', 'default' => '', ], ]; $step->sku('sku', json_encode($sku_params)) ->display(true) ->customFormat(function ($value) use ($step) { if ($value === null) { $data = new \stdClass(); $data->attrs = [ '颜色' => [ '红色', '蓝色', ], '大小' => [ '20', ], ]; $data->sku = [ [ "颜色" => "红色", "大小" => '20', "pic" => '', "stock" => '1', "price" => '100', ], ]; return json_encode($data); } return null; }); }); }); $form->tools(function (Form\Tools $tools) { $tools->disableDelete(); }); }); }
The text was updated successfully, but these errors were encountered:
不支持更新,只能新增
Sorry, something went wrong.
这就尴尬了。
No branches or pull requests
The text was updated successfully, but these errors were encountered: