DeleteAction, delete items in public/storage?
Hey!
I cant seem to find a way, for the DeleteAction to also delete a file from Public/storage.. Am i overlooking something?
Context: The system is a upload/download system, where i want to be able to delete certain files, after i've downloaded them.
I can however not seem to make a good way to use the DeleteAction to do this
Solution:Jump to solution
Don’t use the action to delete the file. Use a model observer. Let the model delete the file.
13 Replies
Solution
Don’t use the action to delete the file. Use a model observer. Let the model delete the file.
Will also be easier when dealing with soft deletes if you’re using them.
I will look into it, Thank you!
It’s laravel thing though, not a Filament thing. 🙂 I do it in the curator plugin so maybe you can use that as an example.
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
Awesome! Thanks! im quite new to PHP, so thanks for nudging me in the right direction (Y)
Using Curator on Infolist Builder
@awcodes
hey awcodes, thanks for all your work on curator - its incredible 🙂
is there an infolist component for it or a simple way to adapt it
curator and glide seem to work on id and infolist seems to take a url approach
im going to work on a closure solution but though I woudl double check before going too far with it
if it's a relationship you could just
ImageEntry::make('featured_image.path')
yes it is 🙂
thank you!
you may need to pass the disk to the ImageEntry too.
ok ill test it now
What if it's not relationship, let's say like from an array?
Please open a new topic with more details on your approach.