How can I update new permission for admin role ? Currently admin can edit post . how can I make admin can delete post ? I'm using spatie laravel permissions. Anyone ? I'm aware with this function but didnt worked for me . should pluck ?
Should it delete all other permissions? Sync does. Look at the example by @sti3bas to add a permission to the role, without removing the others. (unless of course the $request->get('permissions') contains all needed permissions)
it worked now . i need to change role not specific user . i tried syncPermissions and somehow it worked . syncPermission didnt delete other permissions . thank you for your quick response
btw , i try to change role from user to admin . unfortunately, spatie delete the data and didnt assign a new role . just assumed that role_id 3 is admin
$role_id = "3";
role = Role::where('id',$role_id)->first();
$user->syncRoles($role);