選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

TaxType.php 798B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Enums;
  3. use Filament\Support\Contracts\{HasColor, HasIcon, HasLabel};
  4. enum TaxType: string implements HasColor, HasIcon, HasLabel
  5. {
  6. case Sales = 'sales';
  7. case Purchase = 'purchase';
  8. case None = 'none';
  9. public function getLabel(): ?string
  10. {
  11. return $this->name;
  12. }
  13. public function getColor(): string | array | null
  14. {
  15. return match ($this) {
  16. self::Sales => 'success',
  17. self::Purchase => 'warning',
  18. self::None => 'gray',
  19. };
  20. }
  21. public function getIcon(): ?string
  22. {
  23. return match ($this) {
  24. self::Sales => 'heroicon-o-currency-dollar',
  25. self::Purchase => 'heroicon-o-shopping-bag',
  26. self::None => 'heroicon-o-x-circle',
  27. };
  28. }
  29. }