payload['id'] ?? null; if (!$id) { return $this->error('input-error'); } /** * @var SysConfig $model */ $model = SysConfig::query()->find($id); // dump($model); if(!$model){ return $this->error('noinfo'); } try { DB::beginTransaction();; $model->value = $input['value']; if(!$model->save()){ return $this->error('error'); } DB::commit(); }catch (\Exception $exception){ DB::rollBack(); } return $this->success('ok')->refresh(); } public function form() { $id = $this->payload['id'] ?? null; $model = SysConfig::query()->find($id); if(!$model){ return $this->error('错误的')->refresh(); } $this->display('k','Key')->value($model->keyname); $this->display('k','标题')->value($model->title); $this->display('k','描述')->value($model->desc); $this->text('value',"内容")->default($model->value)->required(); } }