Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

EnhancedStat.php 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Filament\Widgets\EnhancedStatsOverviewWidget;
  3. use Closure;
  4. use Filament\Support\Concerns\EvaluatesClosures;
  5. use Filament\Widgets\StatsOverviewWidget\Stat;
  6. use Illuminate\Contracts\Support\Htmlable;
  7. use Illuminate\Contracts\View\View;
  8. class EnhancedStat extends Stat
  9. {
  10. use EvaluatesClosures;
  11. protected string | Htmlable | Closure | null $prefixLabel = null;
  12. protected string | Htmlable | Closure | null $suffixLabel = null;
  13. public function prefix(string | Htmlable | Closure | null $label): static
  14. {
  15. $this->prefixLabel = $label;
  16. return $this;
  17. }
  18. public function suffix(string | Htmlable | Closure | null $label): static
  19. {
  20. $this->suffixLabel = $label;
  21. return $this;
  22. }
  23. public function getPrefixLabel(): string | Htmlable | null
  24. {
  25. return $this->evaluate($this->prefixLabel);
  26. }
  27. public function getSuffixLabel(): string | Htmlable | null
  28. {
  29. return $this->evaluate($this->suffixLabel);
  30. }
  31. public function render(): View
  32. {
  33. return view('filament.widgets.enhanced-stats-overview-widget.enhanced-stat', $this->data());
  34. }
  35. }