From 3321fea50ec7a8d9b9f0708d97ce54e6feb09472 Mon Sep 17 00:00:00 2001 From: Saleh Alzahrani Date: Sat, 6 Jul 2024 21:20:00 -0500 Subject: [PATCH 1/2] Update PdfViewerEntry.php --- src/Infolists/Components/PdfViewerEntry.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Infolists/Components/PdfViewerEntry.php b/src/Infolists/Components/PdfViewerEntry.php index 3e6e979..c399073 100644 --- a/src/Infolists/Components/PdfViewerEntry.php +++ b/src/Infolists/Components/PdfViewerEntry.php @@ -4,6 +4,7 @@ use Filament\Infolists\Components\ViewEntry; use Illuminate\Support\Facades\Storage; +use Closure; class PdfViewerEntry extends ViewEntry { @@ -11,8 +12,8 @@ class PdfViewerEntry extends ViewEntry protected string $minHeight = '50svh'; - protected string $fileUrl = ''; - + protected string | Closure $fileUrl = ''; + public function minHeight(string $minHeight): self { $this->minHeight = $minHeight; @@ -25,7 +26,7 @@ public function getMinHeight(): string return $this->minHeight; } - public function fileUrl(string $fileUrl): self + public function fileUrl(string | Closure $fileUrl): self { $this->fileUrl = $fileUrl; @@ -34,7 +35,7 @@ public function fileUrl(string $fileUrl): self public function getFileUrl(): string { - return $this->fileUrl; + return $this->evaluate($this->fileUrl); } public function getRoute(string $file) From b4ee62264ece7f4e3c079ef03213a1ccfa4cdcfd Mon Sep 17 00:00:00 2001 From: Saleh Alzahrani Date: Sat, 6 Jul 2024 21:21:05 -0500 Subject: [PATCH 2/2] Update PdfViewerEntry.php --- src/Infolists/Components/PdfViewerEntry.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Infolists/Components/PdfViewerEntry.php b/src/Infolists/Components/PdfViewerEntry.php index c399073..146c8f2 100644 --- a/src/Infolists/Components/PdfViewerEntry.php +++ b/src/Infolists/Components/PdfViewerEntry.php @@ -2,9 +2,9 @@ namespace Joaopaulolndev\FilamentPdfViewer\Infolists\Components; -use Filament\Infolists\Components\ViewEntry; -use Illuminate\Support\Facades\Storage; use Closure; +use Illuminate\Support\Facades\Storage; +use Filament\Infolists\Components\ViewEntry; class PdfViewerEntry extends ViewEntry {