first(); if(!$obj) { $obj = new \App\Models\Config(); $obj->key = "coupon_configs"; } $obj->val = json_encode($input); $obj->save(); // return $this ->response() ->success('修改成功') ->refresh(); } /** * Build a form here. */ public function form() { // $this->text("img_title", "排期标题")->required(); $this->image("img", "排期图片")->uniqueName()->removable(false)->autoUpload()->required(); $this->text("desc_title", "规则标题")->required(); $this->textarea("desc", "规则文案")->required(); $this->textarea("pop_desc", "弹窗规则文案")->required(); // } /** * The data of the form. * * @return array */ public function default() { // $obj = \App\Models\Config::where("key", "coupon_configs")->first(); if ($obj && $obj->val) { $data = json_decode($obj->val, true); if ($data) { return $data; } } return [ 'img_title'=> '限定活动排期', 'img'=> '', 'desc_title'=> '如何获得更多礼劵?', 'desc'=> '', 'pop_desc'=> '', ]; } }