diff --git a/src/Traits/HasMedia.php b/src/Traits/HasMedia.php index 00965cb..432cdeb 100644 --- a/src/Traits/HasMedia.php +++ b/src/Traits/HasMedia.php @@ -72,20 +72,31 @@ public function hasMedia(?string $collection_name = null, ?string $collection_gr /** * @return TMedia */ - public function getFirstMedia(?string $collection_name = null, ?string $collection_group = null) - { + public function getFirstMedia( + ?string $collection_name = null, + ?string $collection_group = null + ) { return $this->getMedia($collection_name, $collection_group)->first(); } + /** + * @param null|bool|string|array $fallback + */ public function getFirstMediaUrl( ?string $collection_name = null, ?string $collection_group = null, ?string $conversion = null, + null|bool|string|array $fallback = null, + ?array $parameters = null, ): ?string { $media = $this->getFirstMedia($collection_name, $collection_group); if ($media) { - return $media->getUrl($conversion); + return $media->getUrl( + conversion: $conversion, + fallback: $fallback, + parameters: $parameters + ); } $collection = $this->getMediaCollection($collection_name);