src/MediaTrait.php
public function deleteMediaById($id) {
    $media = $this->getMediaById($id);

    if (!is_null($media)) {
      return $this->removeMedia($media);
    }

    return FALSE;
  }
public function deleteMediaById($id) {
    $media = $this->getMediaById($id);

    if (!is_null($media)) {
      return $this->removeMedia($media);
    }

    return FALSE;
  }
Delete all the media assigned to the current model instance

@param $id int
The ID of the media to delete

@return int
The number of elements deleted