diff --git a/src/Traits/HasRoles.php b/src/Traits/HasRoles.php index 7443e04..c7a7200 100644 --- a/src/Traits/HasRoles.php +++ b/src/Traits/HasRoles.php @@ -172,7 +172,7 @@ public function hasRole($roles): bool break; } } - } else { + } elseif($roles instanceof Collection) { $hasRole = ! $roles->intersect($this->roles)->isEmpty(); } @@ -208,7 +208,7 @@ public function hasAllRoles($roles): bool $hasRoles = $this->roles->contains('name', $roles); } elseif ($roles instanceof Role) { $hasRoles = $this->roles->contains('id', $roles->id); - } else { + } elseif(\is_array($roles) || $roles instanceof Collection) { $roles = \collect()->make($roles)->map(function ($role) { return $role instanceof Role ? $role->name : $role; });