Skip to content
New issue

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

clearMediaCollection() doesn't able to force delete if using softDeletes. #1474

Open
develsanket opened this issue Jun 21, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@develsanket
Copy link

commented Jun 21, 2019

clearMediaCollection() doesn't able to force delete the database record and hence the files also not get removed from the storage. I'm using Laravel's softDeletes trait and while using the clearMediaCollection() method the record in the database gets soft deleted instead of forceDelete(). I think you should change the trait a little bit like what I do:

if (in_array(SoftDeletes::class, class_uses_recursive($entity))) {
$this->getMedia($collectionName)
->each->forceDelete();
} else {
$this->getMedia($collectionName)
->each->delete();
}

@riasvdv

This comment has been minimized.

Copy link
Member

commented Jul 4, 2019

We'd accept a PR for this with tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.