change test result controller

This commit is contained in:
Fateme
2020-06-06 19:19:53 +04:30
parent 6e4e5e255f
commit 7496f1213f
3 changed files with 20 additions and 11 deletions
+20 -11
View File
@@ -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'));
Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB