From 1d66ddcf904ea0fc74dbb85e05fffb6333ed6263 Mon Sep 17 00:00:00 2001 From: liapples Date: Tue, 24 Aug 2021 15:28:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SupplierInfoController.php | 18 ++++++ app/AdminSupplier/Forms/SupplierInfo.php | 63 +++++++++++++++++++ app/AdminSupplier/routes.php | 1 + 3 files changed, 82 insertions(+) create mode 100644 app/AdminSupplier/Controllers/SupplierInfoController.php create mode 100644 app/AdminSupplier/Forms/SupplierInfo.php diff --git a/app/AdminSupplier/Controllers/SupplierInfoController.php b/app/AdminSupplier/Controllers/SupplierInfoController.php new file mode 100644 index 0000000..dd54974 --- /dev/null +++ b/app/AdminSupplier/Controllers/SupplierInfoController.php @@ -0,0 +1,18 @@ +title('供应商信息') + ->body(new Card(' ', new SupplierInfo())); + } +} diff --git a/app/AdminSupplier/Forms/SupplierInfo.php b/app/AdminSupplier/Forms/SupplierInfo.php new file mode 100644 index 0000000..31c271b --- /dev/null +++ b/app/AdminSupplier/Forms/SupplierInfo.php @@ -0,0 +1,63 @@ +id); + + $model->name = $input['name']; + $model->company_name = $input['company_name']; + $model->address = $input['address']; + $model->director = $input['director']; + $model->contact_phone = $input['contact_phone']; + $model->avatar = $input['avatar']; + $model->logo = $input['logo']; + $model->license_pic = $input['license_pic']; + $model->save(); + + return $this->response()->success('保存成功')->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + Admin::translation('supplier'); + + $this->text('name')->required(); + $this->text('company_name')->required(); + $this->text('address')->required(); + $this->text('director')->required(); + $this->text('contact_phone')->required(); + $this->image('avatar'); + $this->image('logo')->required(); + $this->image('license_pic')->required(); + } + + /** + * The data of the form. + * + * @return array + */ + public function default() + { + return Supplier::find(Admin::user()->id)->toArray(); + } +} diff --git a/app/AdminSupplier/routes.php b/app/AdminSupplier/routes.php index 40df52a..d6cec73 100644 --- a/app/AdminSupplier/routes.php +++ b/app/AdminSupplier/routes.php @@ -18,4 +18,5 @@ Route::group([ $router->resource('product/list', 'ProductController'); $router->resource('order/list', 'OrderController'); $router->resource('agent/list', 'AgentController'); + $router->resource('supplier_info', 'SupplierInfoController'); });