Delete exported file
Is there a way to remove the exported files and the relevant database entry for an exporter?
6 Replies
hi @Anish
importing a file or exporting a file in application ?
hi @Anish
for the above question my answer is if you are importing the file to store records create a log for the uploaded file
e.x
table : upload_file
id file_name extension created_at,updated_at need column based on your requirement
add the foriengn key id for upload_file_id in the table
based on the upload file deletion cascade the data
this is what i'm doing my application
if the imported records make any issues.
Exported to csv, downloaded it and cleared from the notification. Now I have no way to access the file from the interface and I don't need it anymore. I would like the file to be removed.
write the unlink function for your file
After checking the documentation, I found that there is a model
which holds the information about the export. One can define a hasMany relation on the User model to get the exports done by the User.
What I now need if there is any event that is dispatched when one clears the notifications. Then I can write a listener which will delete the file and also the corresponding database entry. I think this may be a Laravel Event, so I need to dig up the details on clearing database notifications.
Is there any good answer for this?
I deleted old one, then created new one.