parfum/app/Enums/UserStatus.php
Yoga Pangestu 6317037796 fix(enum): memisahkan method comment dan values ke trait supaya reusable
-menghapus return type
-menyesuaikan value color dan label
2025-09-24 19:25:35 +07:00

43 lines
839 B
PHP

<?php
namespace App\Enums;
use App\Traits\WithCommentEnum;
use App\Traits\WithValueEnum;
enum UserStatus: int
{
use WithCommentEnum, WithValueEnum;
case ACTIVE = 1;
case INACTIVE = 2;
case SUSPENDED = 3;
public function label()
{
return match ($this) {
self::ACTIVE => 'Aktif',
self::INACTIVE => 'Tidak Aktif',
self::SUSPENDED => 'Suspend',
};
}
public function color()
{
return match ($this) {
self::ACTIVE => 'emerald',
self::INACTIVE => 'yellow',
self::SUSPENDED => 'red',
};
}
public function icon()
{
return match ($this) {
self::ACTIVE => 'check-circle',
self::INACTIVE => 'x-circle',
self::SUSPENDED => 'ban',
};
}
}