We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi. As been said in docs:
Media::first()->delete(); Doing so will delete the file from your filesystem, and also remove any association between the media item and your application's models.
Media::first()->delete();
Doing so will delete the file from your filesystem, and also remove any association between the media item and your application's models.
By doing this:
foreach ($blog->getMedia('blogs') as $media) { $media->delete(); }
It detaches media from the model, doesn't delete files from filesystem.
Laravel version: 6.0 optix/media: 0.2.4
The text was updated successfully, but these errors were encountered:
Hi @AliN11
I have checked the code, I really can't find the implementation of that funcionality.
But, you can create your own Media.php model like this:
use Optix\Media\Models\Media as BaseMedia; class Media extends BaseMedia { public static function boot() { parent::boot(); static::deleted(function ($model){ $model->filesystem()->deleteDirectory( $model->getDirectory() ); }); } }
Don't forget to change the config:
return [ 'model' => Your\Path\To\Models\Media::class, ];
Sorry, something went wrong.
No branches or pull requests
Hi. As been said in docs:
By doing this:
It detaches media from the model, doesn't delete files from filesystem.
The text was updated successfully, but these errors were encountered: