diff --git a/app/Http/Controllers/MyAdminController.php b/app/Http/Controllers/MyAdminController.php index 2a74992da3790671b9986d48eca24e0a10abf6e5..362f7fe92dbbf45c6c0c1e06b127fa3b7aa33da0 100644 --- a/app/Http/Controllers/MyAdminController.php +++ b/app/Http/Controllers/MyAdminController.php @@ -126,4 +126,23 @@ class MyAdminController extends MyController $result = $this->getModel()::destroy($this->request('id', 'intval')); return $this->result($result); } + + + /** + * 修改属性 + * @return JsonResponse + */ + public function modifyAction(): JsonResponse + { + $result = false; + + if ($id = $this->request('id', 'intval')) { + + $object = $this->getModel()::find($id); + $object->{$this->request('field')} = $this->request('value'); + $result = $object->save(); + } + + return $this->result($result); + } }