1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
$Group = App\Components\User\Models\Group::find($id); // using permission ID $permissionID = 1 // the permission ID that you add/define on permissions $permissionValue = 1 // values can be (1,-1) allow=1, deny=-1 $Group->addPermission($permissionID,$permissionValue); // using permission object $permission = App\Components\User\Models\Permission::find($id); // the permission object $permissionValue = 1 // values can be (1,-1) allow=1, deny=-1 $Group->addPermission($permission,$permissionValue); NOTE: if the permission is already exist on the group, it will just update the value. // remove a permission $Group->removePermission($permissionID|$permissionObject); |