diff --git a/app/Http/Controllers/TestResultController.php b/app/Http/Controllers/TestResultController.php index f85de790..e7db160a 100644 --- a/app/Http/Controllers/TestResultController.php +++ b/app/Http/Controllers/TestResultController.php @@ -405,18 +405,27 @@ class TestResultController extends Controller } } - if (count($imagesDeleted)) { - foreach ($imagesDeleted as $key => $imageDeleted) { - $Gallery = Gallery::where('path', $imageDeleted)->first(); - if ($Gallery) { - Storage::disk('public')->delete(static::storage_path($imageDeleted)); - Uploadable::where('gallery_id', $Gallery->id)->where('uploadable_id', $TestResult->id)->where('uploadable_type', get_class($TestResult))->delete(); - $Gallery->delete(); - } - } - } - + // if (count($imagesDeleted)) { + // foreach ($imagesDeleted as $key => $imageDeleted) { + // $Gallery = Gallery::where('path', $imageDeleted)->first(); + // if ($Gallery) { + // Storage::disk('public')->delete(static::storage_path($imageDeleted)); + // Uploadable::where('gallery_id', $Gallery->id)->where('uploadable_id', $TestResult->id)->where('uploadable_type', get_class($TestResult))->delete(); + // $Gallery->delete(); + // } + // } + // } + } + if (count($imagesDeleted)) { + foreach ($imagesDeleted as $key => $imageDeleted) { + $Gallery = Gallery::where('path', $imageDeleted)->first(); + if ($Gallery) { + Storage::disk('public')->delete(static::storage_path($imageDeleted)); + Uploadable::where('gallery_id', $Gallery->id)->where('uploadable_id', $TestResult->id)->where('uploadable_type', get_class($TestResult))->delete(); + $Gallery->delete(); + } + } } return \MessageResponse::success(null,trans('messages.update')); diff --git a/public/uploads/TestResults/67/15914528370.jpeg b/public/uploads/TestResults/67/15914528370.jpeg deleted file mode 100644 index aa8085f6..00000000 Binary files a/public/uploads/TestResults/67/15914528370.jpeg and /dev/null differ diff --git a/public/uploads/TestResults/67/15914547070.jpeg b/public/uploads/TestResults/67/15914547070.jpeg new file mode 100644 index 00000000..15c7f4d9 Binary files /dev/null and b/public/uploads/TestResults/67/15914547070.jpeg differ