/**
  * 验证权限
  *
  * @author yangyifan <*****@*****.**>
  */
 private function checkAccess()
 {
     $all_user_menu_url = MenuModel::getUserMenu();
     //用户全部菜单
     $all_menu_url = MenuModel::getAllMenuUrl();
     //当前全部菜单
     if (!empty($all_menu_url)) {
         foreach ($all_menu_url as &$menu) {
             if (!empty($menu)) {
                 $menu = url($menu);
             }
         }
     }
     if (!empty($all_user_menu_url)) {
         foreach ($all_user_menu_url as &$menu) {
             if (!empty($menu)) {
                 $menu = url($menu);
             }
         }
     }
     //如果当前菜单在全局菜单里面,并且不存在角色当前菜单,则没有权限
     if (in_array($this->getCurrentUrl(), $all_menu_url) && !in_array($this->getCurrentUrl(), $all_user_menu_url)) {
         $this->error(trans('response.access_error'));
     }
 }
 /**
  * 删除数据
  *
  * @param $id
  * @throws \Exception
  * @author yangyifan <*****@*****.**>
  */
 public function getDelete($id)
 {
     MenuModel::del($id) > 0 ? $this->response(200, trans('response.delete_success'), [], false, url('admin/news/index')) : $this->response(400, trans('response.delete_error'), [], false);
 }
 /**
  * 获得全部菜单
  *
  * @author yangyifan <*****@*****.**>
  */
 private function getAllMenu()
 {
     view()->share('menu_tree_data', MenuModel::getAllForMenuSide());
 }
 /**
  * 处理新增菜单
  *
  * @author yangyifan <*****@*****.**>
  */
 public function postAdd(MenuRequest $request)
 {
     $affected_number = MenuModel::create($request->all());
     return $affected_number > 0 ? $this->response(200, trans('response.add_success'), [], true, url('admin/menu/index')) : $this->response(400, trans('response.add_error'), [], true, url('admin/menu/index'));
 }