Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

CustomTableRepeater.php 808B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\Filament\Forms\Components;
  3. use Awcodes\TableRepeater\Components\TableRepeater;
  4. use Closure;
  5. class CustomTableRepeater extends TableRepeater
  6. {
  7. protected bool | Closure | null $spreadsheet = null;
  8. public function spreadsheet(bool | Closure $condition = true): static
  9. {
  10. $this->spreadsheet = $condition;
  11. return $this;
  12. }
  13. public function isSpreadsheet(): bool
  14. {
  15. return $this->evaluate($this->spreadsheet) ?? false;
  16. }
  17. protected function setUp(): void
  18. {
  19. parent::setUp();
  20. $this->extraAttributes(function (): array {
  21. $attributes = [];
  22. if ($this->isSpreadsheet()) {
  23. $attributes['class'] = 'is-spreadsheet';
  24. }
  25. return $attributes;
  26. });
  27. }
  28. }