Skip to content

Commit

Permalink
Merge pull request Zizaco#700 from jwright6/bf-352
Browse files Browse the repository at this point in the history
Fixes Issue Zizaco#352
  • Loading branch information
andrewelkins authored Dec 29, 2016
2 parents b999584 + 9edcc5e commit 992e484
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Entrust/Traits/EntrustRoleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function attachPermission($permission)
}

if (is_array($permission)) {
$permission = $permission['id'];
return $this->attachPermissions($permission);
}

$this->perms()->attach($permission);
Expand All @@ -185,11 +185,13 @@ public function attachPermission($permission)
*/
public function detachPermission($permission)
{
if (is_object($permission))
if (is_object($permission)) {
$permission = $permission->getKey();
}

if (is_array($permission))
$permission = $permission['id'];
if (is_array($permission)) {
return $this->detachPermissions($permission);
}

$this->perms()->detach($permission);
}
Expand Down

0 comments on commit 992e484

Please sign in to comment.