Uploaded image not deleted on delete
When deleting a record the image in storage isnt deleted.
I've tried something like this but record is protected
8 Replies
Yes that’s intended and mentioned in the docs.
I think you can access
$this->record
Thanks for your reply
BTW after might be to late since the record is already deleted
I’d use an observer or model event
thanks, I will probably make an observer if there is no other option in filament
How I can delete image which is uploaded via RichText Editor ?
You’d have to parse the content for any images, collect them in an array then delete them. But an observer would still be the best place to do it.
What do you think, what is the proper solution of image is inserted in the editor, but the resource is not updated, so the observer is not fired, but the image is uploaded immediately when inserted in the editor no matter if the resource is saved/updated or not.
Honestly I think you’re worrying about things that don’t truly matter.
Like oh no, there’s unused images on the server that aren’t getting severed. If that actually matters then you need to look into using one of the media manager plugins.
Or create your own media management solution.