updateOrCreate([ 'key' => 'dealer', ], ['value' => $input]); //清配置缓存 app(SettingService::class)->cleanCache('dealer'); return $this ->response() ->success('配置更新成功!') ->refresh(); } /** * Build a form here. */ public function form() { $this->currency('fee_rate', '手续费比例(百分比)')->symbol('%'); $this->table('purchase_rules', '进货补贴规则', function ($table) { $table->number('price', '阶梯(万)'); $table->currency('rate', '比例(百分比)')->symbol('%'); })->disableCreate()->disableDelete(); // $this->embeds('pay_info', '公司收款信息', function ($form) { $this->divider('银行账号收款'); $this->text('bank.user_name', '收款人名称'); $this->text('bank.bank_name', '银行名称'); $this->text('bank.bank_number', '银行名称'); $this->text('bank.bank_description', '开户行'); $this->divider('支付宝收款'); $this->text('alipay.user_name', '收款人名称'); $this->text('alipay.ali_name', '收款账号'); $this->image('alipay.image', '收款码') ->move('dealer/settings/'.Carbon::now()->toDateString()) ->saveFullUrl() ->removable(false) ->retainable() ->autoUpload(); $this->divider('微信收款'); $this->text('wechat.user_name', '收款人名称'); $this->text('wechat.wechat_name', '微信ID'); $this->image('wechat.image', '收款码') ->move('dealer/settings/'.Carbon::now()->toDateString()) ->saveFullUrl() ->removable(false) ->retainable() ->autoUpload(); // })->saving(function ($v) { // // 转化为json格式存储 // dd($v); // return json_encode($v); // })->customFormat(function () use ($dealerSettings) { // return $dealerSettings['pay_info']??[]; // }); } public function default() { $dealerSettings = (array) Setting::where('key', 'dealer')->value('value'); return [ 'fee_rate'=>$dealerSettings['fee_rate'] ?? '', 'bank'=>$dealerSettings['bank'] ?? [], 'alipay'=>$dealerSettings['alipay'] ?? [], 'wechat' =>$dealerSettings['wechat'] ?? [], 'purchase_rules'=>$dealerSettings['purchase_rules'] ?? [], ]; } }