Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

BudgetStatus.php 791B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Enums\Accounting;
  3. use Filament\Support\Contracts\HasColor;
  4. use Filament\Support\Contracts\HasLabel;
  5. enum BudgetStatus: string implements HasColor, HasLabel
  6. {
  7. case Draft = 'draft';
  8. case Active = 'active';
  9. case Closed = 'closed';
  10. public function getLabel(): ?string
  11. {
  12. return $this->name;
  13. }
  14. public function getColor(): string | array | null
  15. {
  16. return match ($this) {
  17. self::Draft => 'gray',
  18. self::Active => 'success',
  19. self::Closed => 'warning',
  20. };
  21. }
  22. public function isEditable(): bool
  23. {
  24. return in_array($this, [self::Draft, self::Active]);
  25. }
  26. public static function editableStatuses(): array
  27. {
  28. return [self::Draft, self::Active];
  29. }
  30. }