$params['pid'], 'type' => $params['type'], 'name' => $params['name'], 'icon' => $params['icon'], 'sort' => $params['sort'], 'paths' => $params['paths'], 'params' => $params['params'], 'is_show' => $params['is_show'], 'is_disable' => $params['is_disable'], 'notes' => $params['notes']??'' ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑用户菜单 * @param array $params * @return bool * @author likeadmin * @date 2023/08/23 09:38 */ public static function edit(array $params): bool { Db::startTrans(); try { UserMenu::where('id', $params['id'])->update([ 'pid' => $params['pid'], 'type' => $params['type'], 'name' => $params['name'], 'icon' => $params['icon'], 'sort' => $params['sort'], 'paths' => $params['paths'], 'params' => $params['params'], 'is_show' => $params['is_show'], 'is_disable' => $params['is_disable'], 'notes' => $params['notes']??'' ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除用户菜单 * @param array $params * @return bool * @author likeadmin * @date 2023/08/23 09:38 */ public static function delete(array $params): bool { return UserMenu::destroy($params['id']); } /** * @notes 获取用户菜单详情 * @param $params * @return array * @author likeadmin * @date 2023/08/23 09:38 */ public static function detail($params): array { return UserMenu::findOrEmpty($params['id'])->toArray(); } }