parfum/app/Enums/ExpenseType.php

34 lines
638 B
PHP

<?php
namespace App\Enums;
use App\Traits\WithCommentEnum;
use App\Traits\WithValueEnum;
enum ExpenseType: int
{
use WithCommentEnum, WithValueEnum;
case OPERATIONAL = 1;
case PURCHASE = 2;
case SALARY = 3;
public function label()
{
return match ($this) {
self::OPERATIONAL => 'Operasional',
self::PURCHASE => 'Belanja',
self::SALARY => 'Gaji',
};
}
public function color()
{
return match ($this) {
self::OPERATIONAL => 'emerald',
self::PURCHASE => 'rose',
self::SALARY => 'cyan',
};
}
}