entrust icon indicating copy to clipboard operation
entrust copied to clipboard

Add detachRole() into Usage Documentation

Open ittikorns opened this issue 10 years ago • 2 comments

I was searching around the Internet to find the detachRole() function. It would be nice if it's documented in the usage section.

ittikorns avatar Mar 03 '16 10:03 ittikorns

Looking at the source for detachRole(), it only requires one argument

public function detachRole($role) { // Just here for an example }

It is the same as Eloquent's detach() method.

From what I can see, you pass in the id of the Role, but you can try the name too.

There is also, detachRoles()

public function detachRoles($roles = null) { // Just here for an example }

And more than likely, this would take an array of the Roles

ghost avatar Mar 04 '16 15:03 ghost

This should really be in the ReadMe. I did something like this and it worked.

$user = User::find(1);
$user->detachRoles($user->roles);

jeremykes avatar Apr 11 '17 13:04 jeremykes