Skip to content

Commit 7e56460

Browse files
committed
add hasMedia
1 parent 52633ca commit 7e56460

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Concerns/HasMedia.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ public function getMedia(
8484
->values();
8585
}
8686

87+
public function hasMedia(
88+
?string $collectionName = null,
89+
?string $collectionGroup = null
90+
): bool {
91+
return $this->getMedia($collectionName, $collectionGroup)->isNotEmpty();
92+
}
93+
8794
/**
8895
* @return TMedia
8996
*/

src/Contracts/InteractWithMedia.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public function getMedia(
4141
?string $collectionGroup = null
4242
): Collection;
4343

44+
public function hasMedia(
45+
?string $collectionName = null,
46+
?string $collectionGroup = null
47+
): bool;
48+
4449
/**
4550
* @return ?TMedia
4651
*/

0 commit comments

Comments
 (0)