Open sebastianBH12 opened 2 years ago
Can you provide more information?
I want to edit an existing user's assigned role
$user->update([ 'name'=>request('name') , 'email'=>request('email') ]); Bouncer::sync($user)->roles([]); $role= $request->input('role'); $user->assign($role);
return redirect()->route('users.show', $user);
I take the role selected in the form, remove the previous one and assign a new one
that the record in roles_assigned is edited and does not generate a new one
instead remove the role and create a new one, the idea is to edit the record in the roles_assigned table
Thank you very much for your attention.
Why would you want the record in roles_assigned
to be updated instead of simply being replaced? What difference does it make?
I need that when editing the information of a user I can also edit the currently assigned role