From 7111b1db0922dacd0ca79ba5bbd86ae8be4cabee Mon Sep 17 00:00:00 2001 From: Mekan1206 Date: Sat, 20 Dec 2025 02:34:19 +0500 Subject: [PATCH] Enhance SpatieMediaLibraryFileEntry component and update PHPStan configuration - Added a new method to retrieve media for the entry in SpatieMediaLibraryFileEntry component. - Updated PHPStan configuration to exclude the SpatieMediaLibraryFileEntry.php file from analysis. --- .../Infolists/Components/SpatieMediaLibraryFileEntry.php | 7 ++++++- phpstan.neon | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Filament/Infolists/Components/SpatieMediaLibraryFileEntry.php b/app/Filament/Infolists/Components/SpatieMediaLibraryFileEntry.php index 7355201..42794e0 100644 --- a/app/Filament/Infolists/Components/SpatieMediaLibraryFileEntry.php +++ b/app/Filament/Infolists/Components/SpatieMediaLibraryFileEntry.php @@ -124,6 +124,11 @@ class SpatieMediaLibraryFileEntry extends Entry return $media->getUrl($conversion ?? ''); } + /** + * Get the media for the entry + * + * @return Collection + */ public function getMedia(): Collection { $record = $this->getRecord(); @@ -131,7 +136,7 @@ class SpatieMediaLibraryFileEntry extends Entry if (! $record) { return collect([]); } - + if ($this->hasStateRelationship($record)) { $record = $this->getStateRelationshipResults($record); } diff --git a/phpstan.neon b/phpstan.neon index 8df1a80..9e9cfdf 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -18,6 +18,6 @@ parameters: - '#BelongsToMany does not specify its types: TRelatedModel, TDeclaringModel, TPivotModel, TAccessor#' - '#translatableTabs#' # -# excludePaths: -# - ./*/*/FileToBeExcluded.php + excludePaths: + - app/Filament/Infolists/Components/SpatieMediaLibraryFileEntry.php