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.
This commit is contained in:
Mekan1206 committed 2025-12-20 02:34:19 +05:00
1 parent c4ee279d91
commit 7111b1db09
2 files changed
+8 -3

No files matched your search

@@ -124,6 +124,11 @@ public function getMediaUrl(Media $media, ?string $conversion = null): string
return $media->getUrl($conversion ?? ''); return $media->getUrl($conversion ?? '');
} }
/**
* Get the media for the entry
*
* @return Collection<array-key, Media>
*/
public function getMedia(): Collection public function getMedia(): Collection
{ {
$record = $this->getRecord(); $record = $this->getRecord();
@@ -131,7 +136,7 @@ public function getMedia(): Collection
if (! $record) { if (! $record) {
return collect([]); return collect([]);
} }
if ($this->hasStateRelationship($record)) { if ($this->hasStateRelationship($record)) {
$record = $this->getStateRelationshipResults($record); $record = $this->getStateRelationshipResults($record);
} }
+2 -2
View File
@@ -18,6 +18,6 @@ parameters:
- '#BelongsToMany does not specify its types: TRelatedModel, TDeclaringModel, TPivotModel, TAccessor#' - '#BelongsToMany does not specify its types: TRelatedModel, TDeclaringModel, TPivotModel, TAccessor#'
- '#translatableTabs#' - '#translatableTabs#'
# #
# excludePaths: excludePaths:
# - ./*/*/FileToBeExcluded.php - app/Filament/Infolists/Components/SpatieMediaLibraryFileEntry.php