Fanamurov / larrock-core

Core components for LarrockCMS
Other
44 stars 4 forks source link

Medialibrary deleteMedia by custom_path_generator_class #1

Closed Fanamurov closed 7 years ago

Fanamurov commented 7 years ago

\Medialibrary\Filesystem:

public function removeFiles(Media $media)
{
    $pathGenerator = PathGeneratorFactory::create();
    $this->filesystem->disk($media->disk)->deleteDirectory($pathGenerator->getPathForConversions($media));
    $this->filesystem->disk($media->disk)->delete($pathGenerator->getPath($media) .'/'. $media->file_name);
}

https://github.com/spatie/laravel-medialibrary/issues/166