Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
774 views
in Technique[技术] by (71.8m points)

delete file laravel dropzone

i have a problem when i delete file. My file is deleted correctly, but in my folder "storage/app/public" keep another folder with my file. I explain myself better, i′m uploading a file with dropzone plugin in laravel. When i upload a file for first time, created a folder with my video in this case, but when i save my changes in profile, dropzone also created a folder, ok??? also in first time, save in database my register with model AppModelsUpload but when i save my data y save model AppModelsRestaurant. well, my problem is that, when i delete my file (video in this case), dropzone delete my second folder created and in database drop row that it have a model AppModelsRestaurant y need that delete all folder, or else, if i have 1000 files in server with the same contain it′s a problem. I don′t know if i′m explaining correctly.

I have this code:

if ($restaurant->hasMedia($input['collection'])) {
                $restaurant->getFirstMedia($input['collection'])->delete();

                /**
                 * delete folder in storage/app/public
                 * delete entry in database model AppModelsUpload and Restaurant
                 */

                $result = $this->uploadRepository->clear($input['uuid']);
                Media::query()->where('model_type', '=', 'AppModelsUpload')->delete();

           }

this line $restaurant->getFirstMedia($input['collection'])->delete(); delete folder and entry in database perfectly when model is Restaurant and folder in storage, but not to do nothing.

with lines:

$result = $this->uploadRepository->clear($input['uuid']);
Media::query()->where('model_type', '=', 'AppModelsUpload')->delete();

i′m traying to delete folder and entries in database but nothing...

How can i delete my other folder and other entries in database?

regards


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...