Skip to content

Commit

Permalink
add deleteMediaConversion
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Jan 25, 2025
1 parent 8141abd commit 23e0816
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Concerns/HasMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,19 @@ public function dispatchMediaConversion(
->filter();

}

/**
* @return Collection<int, TMedia>
*/
public function deleteMediaConversion(
string $conversionName,
?string $collectionName = null,
?string $collectionGroup = null,
): Collection {
return $this
->getMedia($collectionName, $collectionGroup)
->each(function ($media) use ($conversionName) {
return $media->deleteConversion($conversionName);
});
}
}
9 changes: 9 additions & 0 deletions src/Contracts/InteractWithMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,13 @@ public function dispatchMediaConversion(
?string $collectionName = null,
?string $collectionGroup = null,
): \Illuminate\Support\Collection;

/**
* @return Collection<int, TMedia>
*/
public function deleteMediaConversion(
string $conversionName,
?string $collectionName = null,
?string $collectionGroup = null,
): Collection;
}

0 comments on commit 23e0816

Please sign in to comment.