Do I need to keep media in separate folders to be able to delete them individually? #2538
Unanswered
chesterlaykin
asked this question in
Q&A
Replies: 1 comment
-
sadly it seems to be yes: read the last paragraph of docs |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I can't delete images individually when they are being put together in a common folder (using custom path).
I keep media files in folders named as the model id.
As a side note I discovered an error in my project where in a delete method the files were not deleted physically, only the database row.
The delete method was called on the query builder object:
Media::where('id', '=', $id)->delete();
Can you verify that this is the wrong way to delete media?
When I change it into:
Media::find($id)->delete();
Now all media items are removed (including the folder itself I think), not just the specified media id file.
So this doesn't work! Does that mean that we must put the file in folders named as the media id?
I mean, I can adjust the custom path generator and add a folder with the media id - I guess that would fix it.
So that is required then?
(I use version 7.5)
Beta Was this translation helpful? Give feedback.
All reactions