php-tenant/Enums/WorkspaceMemberRole.php
Claude c04549d362
feat: invitation resend, WorkspaceMemberRole enum, configurable expiry
- Add resend() method to WorkspaceInvitation that regenerates the token,
  resets expiry to configured days, and re-sends the notification (#23)
- Create WorkspaceMemberRole backed enum (PHP 8.1+) with label() and
  colour() helpers; deprecate ROLE_* string constants on WorkspaceMember
  and update internal references to use the enum (#24)
- Replace hardcoded 7-day invitation expiry with
  config('tenant.invitation_expiry_days', 7) in both Workspace::invite()
  and WorkspaceInvitation::resend() (#25)

Fixes #23
Fixes #24
Fixes #25

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 13:40:20 +00:00

41 lines
817 B
PHP

<?php
declare(strict_types=1);
namespace Core\Tenant\Enums;
/**
* Workspace member roles.
*
* Backed enum replacing the legacy string constants on WorkspaceMember.
*/
enum WorkspaceMemberRole: string
{
case OWNER = 'owner';
case ADMIN = 'admin';
case MEMBER = 'member';
/**
* Get a human-readable label for the role.
*/
public function label(): string
{
return match ($this) {
self::OWNER => 'Owner',
self::ADMIN => 'Admin',
self::MEMBER => 'Member',
};
}
/**
* Get the colour for this role's badge.
*/
public function colour(): string
{
return match ($this) {
self::OWNER => 'violet',
self::ADMIN => 'blue',
self::MEMBER => 'zinc',
};
}
}