where('id', 1)->find(); $field = [ Form::input('url', '跳转链接', $data['url']), Form::frameImageOne('img', '弹窗图片', Url::buildUrl('admin/widget.images/index', array('fodder' => 'img')), $data['img'])->icon('image')->width('100%')->height('500px'), Form::radio('is_show', '是否显示', $data['is_show'])->options([['label' => '是', 'value' => 1], ['label' => '否', 'value' => 0]]), ]; $form = Form::make_post_form('设置首页弹窗图片', $field, Url::buildUrl('update', array('id' => 1)), 2); $this->assign(compact('form')); return $this->fetch('public/form-builder'); } public function update(Request $request, $id) { $data = UtilService::postMore([ 'url', 'is_show', ['img', []] ], $request); if (!$data['url']) return JsonService::fail('请输入跳转添加地址'); if ($data['img'][0] == "") return JsonService::fail('请上传弹窗图片'); $data['img'] = $data['img'][0]; Db::name('store_popimg')->where('id', 1)->update($data); return JsonService::successful('修改成功!'); } }