src/Controllers/RoleController.php
public function updatePermissions(Request $request, Role $role)
    {
        $this->authorize('manage_permissions', Role::class);
        $permissions = Permission::all();

        foreach ($permissions as $permission) {
            if (array_key_exists($permission->id, $request->all())) {
                $role->addPermission($permission);
            } else {
                $role->deletePermission($permission);
            }
        }

        return redirect()->route('laralum::roles.index')->with('success', __('laralum_roles::general.role_permissions_updated', ['id' => $role->id]));
    }
public function updatePermissions(Request $request, Role $role)
    {
        $this->authorize('manage_permissions', Role::class);
        $permissions = Permission::all();

        foreach ($permissions as $permission) {
            if (array_key_exists($permission->id, $request->all())) {
                $role->addPermission($permission);
            } else {
                $role->deletePermission($permission);
            }
        }

        return redirect()->route('laralum::roles.index')->with('success', __('laralum_roles::general.role_permissions_updated', ['id' => $role->id]));
    }
public function updatePermissions ( Request $ request , Role $ role ) { $ this -> authorize ( 'manage_permissions' , Role :: class ) ; $ permissions = Permission :: all ( ) ; foreach ( $ permissions as $ permission ) { if ( array_key_exists ( $ permission -> id , $ request -> all ( ) ) ) { $ role -> addPermission ( $ permission ) ; } else { $ role -> deletePermission ( $ permission ) ; } } return redirect ( ) -> route ( 'laralum::roles.index' ) -> with ( 'success' , __ ( 'laralum_roles::general.role_permissions_updated' , [ 'id' => $ role -> id ] ) ) ; }
Update the role permissions.

@param \Illuminate\Http\Request   $request
@param \Laralum\Roles\Models\Role $role

@return \Illuminate\Http\Response
Update the role permissions .