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
2025-12-20 02:34:19 +05:00
parent c4ee279d91
commit 7111b1db09
2 changed files with 8 additions and 3 deletions

View File

@@ -124,6 +124,11 @@ class SpatieMediaLibraryFileEntry extends Entry
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 @@ class SpatieMediaLibraryFileEntry extends Entry
if (! $record) { if (! $record) {
return collect([]); return collect([]);
} }
if ($this->hasStateRelationship($record)) { if ($this->hasStateRelationship($record)) {
$record = $this->getStateRelationshipResults($record); $record = $this->getStateRelationshipResults($record);
} }

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