feat(enum): memuat global enum IsActive
This commit is contained in:
parent
b53e873bb8
commit
2b2ed20cbf
38
app/Enums/IsActive.php
Normal file
38
app/Enums/IsActive.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Enums;
|
||||||
|
|
||||||
|
use App\Traits\WithCommentEnum;
|
||||||
|
use App\Traits\WithValueEnum;
|
||||||
|
|
||||||
|
enum IsActive: int
|
||||||
|
{
|
||||||
|
use WithCommentEnum, WithValueEnum;
|
||||||
|
|
||||||
|
case ACTIVE = 1;
|
||||||
|
case INACTIVE = 2;
|
||||||
|
|
||||||
|
public function label()
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::ACTIVE => 'Aktif',
|
||||||
|
self::INACTIVE => 'Tidak Aktif',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function color()
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::ACTIVE => 'emerald',
|
||||||
|
self::INACTIVE => 'red',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function icon()
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
self::ACTIVE => 'check-circle',
|
||||||
|
self::INACTIVE => 'x-circle',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user