src/HasMedia/HasMediaTrait.php
public function clearMediaCollection(string $collectionName = 'default'): self
    {
        $this->getMedia($collectionName)
            ->each->delete();

        event(new CollectionHasBeenCleared($this, $collectionName));

        if ($this->mediaIsPreloaded()) {
            unset($this->media);
        }

        return $this;
    }
public function clearMediaCollection(string $collectionName = 'default'): self
    {
        $this->getMedia($collectionName)
            ->each->delete();

        event(new CollectionHasBeenCleared($this, $collectionName));

        if ($this->mediaIsPreloaded()) {
            unset($this->media);
        }

        return $this;
    }
public function clearMediaCollection ( string $ collectionName = 'default' ) : self { $ this -> getMedia ( $ collectionName ) -> each -> delete ( ) ; event ( new CollectionHasBeenCleared ( $ this , $ collectionName ) ) ; if ( $ this -> mediaIsPreloaded ( ) ) { unset ( $ this -> media ) ; } return $ this ; }
Remove all media in the given collection.

@param string $collectionName

@return $this
Remove all media in the given collection .