firstOrCreate([ 'key' => 'single' ]); $arr = [ 'price' => $input['price'], ]; $system->value = $arr; $system->save(); return $this ->response() ->success('设置成功') ->refresh(); } /** * Build a form here. */ public function form() { $this->decimal('price','单人头交易费')->rules('required|numeric|min:0|not_in:0',[ '*' => '金额为必填字段且必须大于0', ]); } /** * The data of the form. * * @return array */ public function default() { $system = \App\Models\SystemSetting::query()->where('key','single')->value('value'); return [ 'price' => $system['price'] ?? 0, ]; } }