code: public function addMenu(Request $request)
      {
          $menu_logic = MenuLogic::instance();
          if ($request->isPost()) {
              $data = [
                  'menu_name' => $request->param('menu_name'),
                  'menu_url' => $request->param('menu_url'),
                  'menu_pid' => $request->param('menu_pid', 0),
                  'menu_group' => $request->param('menu_group', ''),
                  'menu_sort' => $request->param('menu_sort', 0),
                  'menu_target' => $request->param('menu_target', ''),
                  'menu_build' => $request->param('menu_build', 0),
                  'menu_status' => $request->param('menu_status', 0)
              ];
              
              // 验证菜单
              $res = $menu_logic->validate->scene('add')->check($data);
              if (! $res) {
                  return $this->error($menu_logic->validate->getError());
              }
              
              // 添加菜单
              $menu_logic->addMenu($data);
              
              return $this->success('添加菜单成功', Url::build('menu/index', [
                  'menu_pid' => $request->param('menu_pid')
              ]));
          } else {
              $this->site_title = '新增菜单';
              
              // 上级，返回用
              $menu_pid = $request->param('menu_pid', 0);
              $this->assign('menu_pid', intval($menu_pid));
              
              // 上级菜单下拉选择
              $menu_select = $menu_logic->getMenuSelect();
              $this->assign('menu_select', $menu_select);
              
              // 打开方式
              $menu_target = $menu_logic->menuTarget();
              $this->assign('menu_target', $menu_target);
              
              // 是否build
              $menu_build = $menu_logic->menuBuild();
              $this->assign('menu_build', $menu_build);
              
              // 菜单状态
              $menu_status = $menu_logic->menuStatus();
              $this->assign('menu_status', $menu_status);
              
              return $this->fetch();
          }
      }
docs: 添加菜单
  
  @param Request $request
  @return mixed