> For the complete documentation index, see [llms.txt](https://windhoney.gitbook.io/yii2-rest-rbac/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://windhoney.gitbook.io/yii2-rest-rbac/menu/menu-update.md).

# 更新

## **菜单-更新**

* 接口名称：更新菜单
* 请求方式：post
* 请求示例：[/rbac/menus/update?id=xxx](https://github.com/windhoney/yii2-rest-rbac/tree/5607a3fc72fd54f761435b601794fd2091885740/%7B%7Bbook.api_url%7D%7D/rbac/menus/update?id=51/README.md)
* 请求参数说明：

| 元素名称         | 数据类型   | 是否非空 | 元素说明 | 备注                                                                                      |
| ------------ | ------ | ---- | ---- | --------------------------------------------------------------------------------------- |
| id           | string | 是    | 菜单ID | [菜单详情](/yii2-rest-rbac/menu/menu-view.md)，或[菜单列表中](/yii2-rest-rbac/menu/menu-list.md)获取 |
| name         | string | 是    | 名称   | ---                                                                                     |
| parent       | string | 是    | 父级ID | [通过菜单列表下拉获取-id字段](/yii2-rest-rbac/menu/menu-list.md)                                    |
| parent\_name | string | 是    | 父级名字 | [通过菜单列表下拉获取-name字段](/yii2-rest-rbac/menu/menu-list.md)                                  |
| route        | string | 是    | 路由   | [通过路由列表下拉获取-name字段](/yii2-rest-rbac/route/route-list.md)                                |
| order        | string | 是    | 排序   | ---                                                                                     |
| data         | string | 是    | 数据   | ---                                                                                     |

## **添加示例：**

* 数据格式：数组

  ```php
  {
    "name": "哈哈啊哈哈1",
    "parent": "46",
    "route": "/route1",
    "order": "1",
    "parent_name": "订单列表",
    "data": "手动添加菜单"
  }
  ```

  **返回信息：**
* 数据格式：JSON
* 成功示例：

成功 返回更新后的详情

```php
{
    "code": 200,
    "message": "OK",
    "data": {
        "id": 51,
        "name": "哈哈啊哈哈1444",
        "parent": 46,
        "route": "/于淼",
        "order": null,
        "data": "手动添加菜单"
    }
}
```

* 失败示例：

  ```php
  { 
    "code": 400, 
    "message": "操作失败",
  }
  ```
