diff --git a/app/Admin/Controllers/ProductFeatureController.php b/app/Admin/Controllers/ProductFeatureController.php new file mode 100644 index 00000000..6b3e35db --- /dev/null +++ b/app/Admin/Controllers/ProductFeatureController.php @@ -0,0 +1,94 @@ +column('id')->sortable(); + $grid->column('name'); + $grid->column('icon')->image(50, 50); + $grid->column('remarks'); + $grid->column('created_at')->sortable(); + + //排序 + $grid->model()->orderBy('created_at', 'desc'); + + /** 操作 **/ + //新增 + if (Admin::user()->can('dcat.admin.product_features.create')) { + $grid->disableCreateButton(false); + $grid->enableDialogCreate(); + } + + //修改 + $grid->showQuickEditButton(Admin::user()->can('dcat.admin.product_features.edit')); + //删除以及自定义操作 + $grid->actions(function (Grid\Displayers\Actions $actions) { + $actions->disableDelete(Admin::user()->cannot('dcat.admin.product_features.destroy')); + }); + + /** 查询 **/ + $grid->filter(function (Grid\Filter $filter) { + $filter->panel(); + $filter->like('name')->width(3); + }); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + return Show::make($id, new ProductFeature(), function (Show $show) { + $show->field('id'); + $show->field('name'); + $show->field('icon'); + $show->field('remarks'); + $show->field('created_at'); + $show->field('updated_at'); + }); + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new ProductFeature(), function (Form $form) { + $form->display('id'); + $form->text('name')->required(); + $form->image('icon') + ->move('product-features/'.Carbon::now()->toDateString()) + ->saveFullUrl() + ->removable(false) + ->autoUpload(); + $form->text('remarks'); + + $form->display('created_at'); + $form->display('updated_at'); + }); + } +} diff --git a/app/Admin/Repositories/ProductFeature.php b/app/Admin/Repositories/ProductFeature.php new file mode 100644 index 00000000..2fb340f5 --- /dev/null +++ b/app/Admin/Repositories/ProductFeature.php @@ -0,0 +1,16 @@ +names('product_groups'); + $router->resource('product-features', 'ProductFeatureController')->only([ + 'index', 'create', 'store', 'edit', 'update', 'destroy', + ])->names('product_features'); + $router->resource('product-spus', 'ProductSpuController')->names('product_spus'); + + /** api接口 **/ $router->get('api/product-categories', 'ProductCategoryController@list')->name('api.product_categories'); $router->get('api/product-group-details', 'ProductGroupController@details')->name('api.product_group_details'); diff --git a/app/Models/ProductFeature.php b/app/Models/ProductFeature.php new file mode 100644 index 00000000..e91d2e6f --- /dev/null +++ b/app/Models/ProductFeature.php @@ -0,0 +1,13 @@ +id(); + $table->string('name')->comment('名称'); + $table->string('icon')->nullable()->comment('图标'); + $table->string('remarks')->nullable()->comment('备注'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('product_features'); + } +} diff --git a/dcat_admin_ide_helper.php b/dcat_admin_ide_helper.php index e765e96e..bb42dbbf 100644 --- a/dcat_admin_ide_helper.php +++ b/dcat_admin_ide_helper.php @@ -63,22 +63,25 @@ namespace Dcat\Admin { * @property Grid\Column|Collection token * @property Grid\Column|Collection abilities * @property Grid\Column|Collection last_used_at - * @property Grid\Column|Collection group_id + * @property Grid\Column|Collection remarks * @property Grid\Column|Collection attrs + * @property Grid\Column|Collection specs + * @property Grid\Column|Collection part_id + * @property Grid\Column|Collection sku_id * @property Grid\Column|Collection spu_id * @property Grid\Column|Collection images * @property Grid\Column|Collection sell_price * @property Grid\Column|Collection market_price * @property Grid\Column|Collection cost_price - * @property Grid\Column|Collection user_price + * @property Grid\Column|Collection vip_price * @property Grid\Column|Collection media * @property Grid\Column|Collection weight - * @property Grid\Column|Collection is_sell - * @property Grid\Column|Collection spec_items * @property Grid\Column|Collection stock - * @property Grid\Column|Collection sells - * @property Grid\Column|Collection items + * @property Grid\Column|Collection sales + * @property Grid\Column|Collection release_at * @property Grid\Column|Collection product_spu_id + * @property Grid\Column|Collection items + * @property Grid\Column|Collection is_sell * @property Grid\Column|Collection phone * @property Grid\Column|Collection code * @property Grid\Column|Collection is_use @@ -148,22 +151,25 @@ namespace Dcat\Admin { * @method Grid\Column|Collection token(string $label = null) * @method Grid\Column|Collection abilities(string $label = null) * @method Grid\Column|Collection last_used_at(string $label = null) - * @method Grid\Column|Collection group_id(string $label = null) + * @method Grid\Column|Collection remarks(string $label = null) * @method Grid\Column|Collection attrs(string $label = null) + * @method Grid\Column|Collection specs(string $label = null) + * @method Grid\Column|Collection part_id(string $label = null) + * @method Grid\Column|Collection sku_id(string $label = null) * @method Grid\Column|Collection spu_id(string $label = null) * @method Grid\Column|Collection images(string $label = null) * @method Grid\Column|Collection sell_price(string $label = null) * @method Grid\Column|Collection market_price(string $label = null) * @method Grid\Column|Collection cost_price(string $label = null) - * @method Grid\Column|Collection user_price(string $label = null) + * @method Grid\Column|Collection vip_price(string $label = null) * @method Grid\Column|Collection media(string $label = null) * @method Grid\Column|Collection weight(string $label = null) - * @method Grid\Column|Collection is_sell(string $label = null) - * @method Grid\Column|Collection spec_items(string $label = null) * @method Grid\Column|Collection stock(string $label = null) - * @method Grid\Column|Collection sells(string $label = null) - * @method Grid\Column|Collection items(string $label = null) + * @method Grid\Column|Collection sales(string $label = null) + * @method Grid\Column|Collection release_at(string $label = null) * @method Grid\Column|Collection product_spu_id(string $label = null) + * @method Grid\Column|Collection items(string $label = null) + * @method Grid\Column|Collection is_sell(string $label = null) * @method Grid\Column|Collection phone(string $label = null) * @method Grid\Column|Collection code(string $label = null) * @method Grid\Column|Collection is_use(string $label = null) @@ -238,22 +244,25 @@ namespace Dcat\Admin { * @property Show\Field|Collection token * @property Show\Field|Collection abilities * @property Show\Field|Collection last_used_at - * @property Show\Field|Collection group_id + * @property Show\Field|Collection remarks * @property Show\Field|Collection attrs + * @property Show\Field|Collection specs + * @property Show\Field|Collection part_id + * @property Show\Field|Collection sku_id * @property Show\Field|Collection spu_id * @property Show\Field|Collection images * @property Show\Field|Collection sell_price * @property Show\Field|Collection market_price * @property Show\Field|Collection cost_price - * @property Show\Field|Collection user_price + * @property Show\Field|Collection vip_price * @property Show\Field|Collection media * @property Show\Field|Collection weight - * @property Show\Field|Collection is_sell - * @property Show\Field|Collection spec_items * @property Show\Field|Collection stock - * @property Show\Field|Collection sells - * @property Show\Field|Collection items + * @property Show\Field|Collection sales + * @property Show\Field|Collection release_at * @property Show\Field|Collection product_spu_id + * @property Show\Field|Collection items + * @property Show\Field|Collection is_sell * @property Show\Field|Collection phone * @property Show\Field|Collection code * @property Show\Field|Collection is_use @@ -323,22 +332,25 @@ namespace Dcat\Admin { * @method Show\Field|Collection token(string $label = null) * @method Show\Field|Collection abilities(string $label = null) * @method Show\Field|Collection last_used_at(string $label = null) - * @method Show\Field|Collection group_id(string $label = null) + * @method Show\Field|Collection remarks(string $label = null) * @method Show\Field|Collection attrs(string $label = null) + * @method Show\Field|Collection specs(string $label = null) + * @method Show\Field|Collection part_id(string $label = null) + * @method Show\Field|Collection sku_id(string $label = null) * @method Show\Field|Collection spu_id(string $label = null) * @method Show\Field|Collection images(string $label = null) * @method Show\Field|Collection sell_price(string $label = null) * @method Show\Field|Collection market_price(string $label = null) * @method Show\Field|Collection cost_price(string $label = null) - * @method Show\Field|Collection user_price(string $label = null) + * @method Show\Field|Collection vip_price(string $label = null) * @method Show\Field|Collection media(string $label = null) * @method Show\Field|Collection weight(string $label = null) - * @method Show\Field|Collection is_sell(string $label = null) - * @method Show\Field|Collection spec_items(string $label = null) * @method Show\Field|Collection stock(string $label = null) - * @method Show\Field|Collection sells(string $label = null) - * @method Show\Field|Collection items(string $label = null) + * @method Show\Field|Collection sales(string $label = null) + * @method Show\Field|Collection release_at(string $label = null) * @method Show\Field|Collection product_spu_id(string $label = null) + * @method Show\Field|Collection items(string $label = null) + * @method Show\Field|Collection is_sell(string $label = null) * @method Show\Field|Collection phone(string $label = null) * @method Show\Field|Collection code(string $label = null) * @method Show\Field|Collection is_use(string $label = null) @@ -359,7 +371,8 @@ namespace Dcat\Admin { class Show {} /** - + * @method \App\Admin\Extensions\Form\Product\SelectAttr selectAttr(...$params) + * @method \App\Admin\Extensions\Form\Product\SelectSpec selectSpec(...$params) */ class Form {} diff --git a/resources/lang/zh_CN/product-feature.php b/resources/lang/zh_CN/product-feature.php new file mode 100644 index 00000000..c539fead --- /dev/null +++ b/resources/lang/zh_CN/product-feature.php @@ -0,0 +1,15 @@ + [ + 'ProductFeature' => '商品特点', + 'product-features' => '商品特点', + ], + 'fields' => [ + 'name' => '名称', + 'icon' => '图标', + 'remarks' => '备注', + ], + 'options' => [ + ], +];