|
| xqd
@@ -22,33 +22,7 @@ class SettingController extends AdminController
|
|
|
public function index(Content $content)
|
|
|
{
|
|
|
|
|
|
- $form = new Form(new Setting(), function (Form $form) {
|
|
|
- $form->action(admin_url('setting'));
|
|
|
- $form->tools(
|
|
|
- function (Form\Tools $tools) {
|
|
|
- $tools->disableList();
|
|
|
- }
|
|
|
- );
|
|
|
- $form->disableCreatingCheck();
|
|
|
- $form->disableEditingCheck();
|
|
|
- $form->disableViewCheck();
|
|
|
-
|
|
|
-
|
|
|
- $form->display('id', 'ID');
|
|
|
- $form->text('name', '会员价格')->required();
|
|
|
- $form->text('origin_member_price', '会员原价')->required();
|
|
|
- $form->text('service_wechat', '客服微信号')->required();
|
|
|
- $form->image('service_qrcode', '客服二维码')->autoUpload();
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- $form->saved(function (Form $form) {
|
|
|
- return $form
|
|
|
- ->response()
|
|
|
- ->success(trans('admin.update_succeeded'))
|
|
|
- ->redirect('/setting');
|
|
|
- });
|
|
|
- });
|
|
|
+ $form = $this->form();
|
|
|
return $content
|
|
|
->title(trans('admin.user_setting'))
|
|
|
->body($form->edit(Setting::orderBy('id','asc')->first()->getKey()));
|
|
| xqd
@@ -72,30 +46,40 @@ class SettingController extends AdminController
|
|
|
return $response->success(__('admin.save_succeeded'));
|
|
|
}
|
|
|
|
|
|
+ public function setting()
|
|
|
+ {
|
|
|
+ $form = $this->form();
|
|
|
+ return $form->update(Setting::orderBy('id','asc')->first()->getKey());
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * Make a form builder.
|
|
|
- *
|
|
|
- * @return Form
|
|
|
- */
|
|
|
protected function form()
|
|
|
{
|
|
|
- return Form::make(new ShareConfig(), function (Form $form) {
|
|
|
- $id = $form->getKey();
|
|
|
- $form->text('id', 'ID');
|
|
|
- $form->text('member_price','会员价格');
|
|
|
- $form->text('origin_member_price','会员原价');
|
|
|
- $form->text('service_wechat','客服微信号');
|
|
|
- $form->text('service_qrcode','客服二维码');
|
|
|
+ return new Form(new Setting(), function (Form $form) {
|
|
|
+ $form->action(admin_url('setting'));
|
|
|
+ $form->tools(
|
|
|
+ function (Form\Tools $tools) {
|
|
|
+ $tools->disableList();
|
|
|
+ }
|
|
|
+ );
|
|
|
+ $form->disableCreatingCheck();
|
|
|
+ $form->disableEditingCheck();
|
|
|
+ $form->disableViewCheck();
|
|
|
+
|
|
|
+
|
|
|
+ $form->display('id', 'ID');
|
|
|
+ $form->text('member_price', '会员价格')->required();
|
|
|
+ $form->text('origin_member_price', '会员原价')->required();
|
|
|
+ $form->text('service_wechat', '客服微信号')->required();
|
|
|
+ $form->image('service_qrcode', '客服二维码')->autoUpload();
|
|
|
|
|
|
- })->saved(function (Form $form, $result) {
|
|
|
- $response = $form->updates()->response();
|
|
|
|
|
|
- if ($result) {
|
|
|
- return $response->success(__('admin.save_succeeded'));
|
|
|
- }
|
|
|
|
|
|
- return $response->info(__('admin.nothing_updated'));
|
|
|
+ $form->saved(function (Form $form) {
|
|
|
+ return $form
|
|
|
+ ->response()
|
|
|
+ ->success(trans('admin.update_succeeded'))
|
|
|
+ ->redirect('/setting');
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
}
|