Files
SkinbaseNova/app/Enums/UserRole.php

48 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Enums;
enum UserRole: string
{
case User = 'user';
case Creator = 'creator';
case Moderator = 'moderator';
case Editorial = 'editorial';
case Manager = 'manager';
case Admin = 'admin';
/** Roles that grant access to the /admin panel. */
public static function staffRoles(): array
{
return [self::Editorial, self::Manager, self::Admin];
}
/** Human-friendly label. */
public function label(): string
{
return match ($this) {
self::User => 'User',
self::Creator => 'Creator',
self::Moderator => 'Moderator',
self::Editorial => 'Editorial',
self::Manager => 'Manager',
self::Admin => 'Admin',
};
}
/** Badge color class (Tailwind). */
public function badgeClass(): string
{
return match ($this) {
self::User => 'bg-slate-500/20 text-slate-300',
self::Creator => 'bg-sky-500/20 text-sky-300',
self::Moderator => 'bg-violet-500/20 text-violet-300',
self::Editorial => 'bg-teal-500/20 text-teal-300',
self::Manager => 'bg-amber-500/20 text-amber-300',
self::Admin => 'bg-rose-500/20 text-rose-300',
};
}
}