You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ContactType.php 987B

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