The updateGroupsMenus function in UserSpice is used to update the relationship between groups and menus in the database. It removes the existing associations for the specified menu IDs and then adds new associations for the provided group IDs and menu IDs
Location
users/helpers/us_helpers.php
Parameters
#
Parameter
Data Type
Required
Description
1
$group_ids
integer
Yes
The ID or an array of IDs of the groups.
2
$menu_ids
integer
Yes
The ID or an array of IDs of the menus.
Further Documentation:
// Update the group-menu associations $groupIds = [1, 2, 3]; // Array of group IDs $menuIds = [4, 5, 6]; // Array of menu IDs
In the example above, the updateGroupsMenus function is called to update the group-menu associations. The function takes an array of group IDs ($groupIds) and an array of menu IDs ($menuIds) as parameters. It removes the existing associations for the specified menu IDs and then adds new associations for the provided group IDs and menu IDs using the addGroupsMenus function. After the update is complete, a success message is displayed to indicate that the group-menu associations have been updated.