Skip to content

Commit

Permalink
Added UserRole type in hasRole() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
eneakh committed Sep 19, 2023
1 parent 48c0b67 commit 0b5bbb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ $user->hasRolePermission($role, $permission) : bool
// Determine if the user has a given permission...
$user->hasPermission($permission) : bool
```
> All method parameters accept string, array, Collection and Enum if you chose to use so.
> All method arguments can accept string, array, Collection or Enum if desired.
> For optimal performance, it is advisable to use array or Collection as arguments when handling multiple entries.
### Roles & Permissions
Users can receive roles with permissions defined in `App\Providers\LadderServiceProvider` using `Ladder::role` method. This involves specifying a role's slug, name, permissions, and description. For instance, in a blog app, role definitions could be:
Expand Down
2 changes: 1 addition & 1 deletion src/HasRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function findRole(UserRole $userRole): ?Role
return Ladder::findRole($userRole->role);
}

public function hasRole(string|array|Collection|BackedEnum $roles): bool
public function hasRole(string|array|Collection|UserRole|BackedEnum $roles): bool
{
return $this->filterRoles($roles)->isNotEmpty();
}
Expand Down

0 comments on commit 0b5bbb4

Please sign in to comment.