您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

EstimateStatus.php 847B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Enums\Accounting;
  3. use Filament\Support\Contracts\HasColor;
  4. use Filament\Support\Contracts\HasLabel;
  5. enum EstimateStatus: string implements HasColor, HasLabel
  6. {
  7. case Draft = 'draft';
  8. case Sent = 'sent';
  9. case Viewed = 'viewed';
  10. case Unsent = 'unsent';
  11. case Accepted = 'accepted';
  12. case Declined = 'declined';
  13. case Expired = 'expired';
  14. case Converted = 'converted';
  15. public function getLabel(): ?string
  16. {
  17. return $this->name;
  18. }
  19. public function getColor(): string | array | null
  20. {
  21. return match ($this) {
  22. self::Draft, self::Unsent => 'gray',
  23. self::Sent, self::Viewed => 'primary',
  24. self::Accepted, self::Converted => 'success',
  25. self::Declined => 'danger',
  26. self::Expired => 'warning',
  27. };
  28. }
  29. }