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

ContactType.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace App\Enums;
  3. use Filament\Support\Colors\Color;
  4. use Filament\Support\Contracts\HasColor;
  5. use Filament\Support\Contracts\HasIcon;
  6. use Filament\Support\Contracts\HasLabel;
  7. enum ContactType: string implements HasColor, HasIcon, HasLabel
  8. {
  9. case Employee = 'employee';
  10. case Customer = 'customer';
  11. case Vendor = 'vendor';
  12. case Supplier = 'supplier';
  13. public function getLabel(): ?string
  14. {
  15. return $this->name;
  16. }
  17. public function getColor(): string | array | null
  18. {
  19. return match ($this) {
  20. self::Employee => Color::Green,
  21. self::Customer => Color::Blue,
  22. self::Vendor => Color::Orange,
  23. self::Supplier => Color::Purple,
  24. };
  25. }
  26. public function getIcon(): ?string
  27. {
  28. return match ($this) {
  29. self::Employee => 'heroicon-o-user-group',
  30. self::Customer => 'heroicon-o-user',
  31. self::Vendor => 'heroicon-o-shopping-bag',
  32. self::Supplier => 'heroicon-o-truck',
  33. };
  34. }
  35. }