Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Traits/HasRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public function getRoleNames(): Collection
return $this->roles->pluck('name');
}

protected function getStoredRole($role): Role
protected function getStoredRole($role): static
{
if ($role instanceof \BackedEnum) {
$role = $role->value;
Expand All @@ -412,7 +412,11 @@ protected function getStoredRole($role): Role
return $this->getRoleClass()::findByName($role, $this->getDefaultGuardName());
}

return $role;
if ($role instanceof Role) {
return $role;
}

throw new \TypeError('Unsupported type');
}

protected function convertPipeToArray(string $pipeString)
Expand Down