From bb7d56c68c3823f3b18ecb1c92938878cd046e46 Mon Sep 17 00:00:00 2001 From: liapples Date: Tue, 24 Aug 2021 14:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=90=86=E5=95=86?= =?UTF-8?q?=E7=9A=84=E5=90=88=E4=BD=9C=E4=BE=9B=E5=BA=94=E5=95=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SupplierController.php | 92 +++++++++++++++++++ app/AdminAgent/Repositories/Supplier.php | 16 ++++ app/AdminAgent/routes.php | 1 + dcat_admin_ide_helper.php | 4 + 4 files changed, 113 insertions(+) create mode 100644 app/AdminAgent/Controllers/SupplierController.php create mode 100644 app/AdminAgent/Repositories/Supplier.php diff --git a/app/AdminAgent/Controllers/SupplierController.php b/app/AdminAgent/Controllers/SupplierController.php new file mode 100644 index 0000000..c1a4e87 --- /dev/null +++ b/app/AdminAgent/Controllers/SupplierController.php @@ -0,0 +1,92 @@ +disableActions(); + $grid->disableCreateButton(); + $grid->disableRowSelector(); + $grid->disableFilterButton(); + + $grid->model()->where(function ($query) { + return $query->whereHas('AgentProductItem', function ($query) { + return $query->where('agent_id', Admin::user()->id); + }); + }); + + $grid->column('id')->sortable(); + $grid->column('name'); + $grid->column('company_name'); + $grid->column('address'); + $grid->column('director'); + $grid->column('contact_phone'); + $grid->column('logo')->image('', 60, 60); + $grid->column('avatar')->image('', 60, 60); + $grid->column('license_pic')->image('', 60, 60); + $grid->column('created_at', '入驻时间'); + + $grid->filter(function (Grid\Filter $filter) { + $filter->panel(); + + $filter->equal('id'); + }); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + return Show::make($id, new Supplier(), function (Show $show) { + $show->field('id'); + /*$show->field('name'); + $show->field('company_name'); + $show->field('address'); + $show->field('director'); + $show->field('contact_phone'); + $show->field('logo'); + $show->field('avatar'); + $show->field('license_pic'); + $show->field('created_at'); + $show->field('updated_at');*/ + }); + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new Supplier(), function (Form $form) { + $form->display('id'); + })->saving(function (Form $form) { + $form->response()->error('操作禁止'); + })->deleting(function (Form $form) { + $form->response()->error('操作禁止'); + }); + } +} diff --git a/app/AdminAgent/Repositories/Supplier.php b/app/AdminAgent/Repositories/Supplier.php new file mode 100644 index 0000000..067a134 --- /dev/null +++ b/app/AdminAgent/Repositories/Supplier.php @@ -0,0 +1,16 @@ +resource('message/list', 'MessageController'); $router->resource('notice/list', 'NoticeController'); $router->resource('agent_info', 'AgentInfoController'); + $router->resource('supplier/list', 'SupplierController'); }); diff --git a/dcat_admin_ide_helper.php b/dcat_admin_ide_helper.php index 371bf3d..473a1fa 100644 --- a/dcat_admin_ide_helper.php +++ b/dcat_admin_ide_helper.php @@ -103,6 +103,7 @@ namespace Dcat\Admin { * @property Grid\Column|Collection money * @property Grid\Column|Collection order_id * @property Grid\Column|Collection transaction_id + * @property Grid\Column|Collection is_verify * @property Grid\Column|Collection nickname * @property Grid\Column|Collection openid * @property Grid\Column|Collection unionid @@ -199,6 +200,7 @@ namespace Dcat\Admin { * @method Grid\Column|Collection money(string $label = null) * @method Grid\Column|Collection order_id(string $label = null) * @method Grid\Column|Collection transaction_id(string $label = null) + * @method Grid\Column|Collection is_verify(string $label = null) * @method Grid\Column|Collection nickname(string $label = null) * @method Grid\Column|Collection openid(string $label = null) * @method Grid\Column|Collection unionid(string $label = null) @@ -300,6 +302,7 @@ namespace Dcat\Admin { * @property Show\Field|Collection money * @property Show\Field|Collection order_id * @property Show\Field|Collection transaction_id + * @property Show\Field|Collection is_verify * @property Show\Field|Collection nickname * @property Show\Field|Collection openid * @property Show\Field|Collection unionid @@ -396,6 +399,7 @@ namespace Dcat\Admin { * @method Show\Field|Collection money(string $label = null) * @method Show\Field|Collection order_id(string $label = null) * @method Show\Field|Collection transaction_id(string $label = null) + * @method Show\Field|Collection is_verify(string $label = null) * @method Show\Field|Collection nickname(string $label = null) * @method Show\Field|Collection openid(string $label = null) * @method Show\Field|Collection unionid(string $label = null)