Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

DocumentPreview.php 934B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Filament\Forms\Components;
  3. use App\Enums\Setting\Template;
  4. use Closure;
  5. use Filament\Forms\Components\Grid;
  6. class DocumentPreview extends Grid
  7. {
  8. protected string $view = 'filament.forms.components.document-preview';
  9. protected bool | Closure $isPreview = false;
  10. protected Template | Closure $template = Template::Default;
  11. protected function setUp(): void
  12. {
  13. parent::setUp();
  14. }
  15. public function preview(bool | Closure $condition = true): static
  16. {
  17. $this->isPreview = $condition;
  18. return $this;
  19. }
  20. public function template(Template | Closure $template): static
  21. {
  22. $this->template = $template;
  23. return $this;
  24. }
  25. public function isPreview(): bool
  26. {
  27. return (bool) $this->evaluate($this->isPreview);
  28. }
  29. public function getTemplate(): Template
  30. {
  31. return $this->evaluate($this->template);
  32. }
  33. }