From 300a2eb43a83ce1dc600b5930578e007c9b605a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Wed, 15 Dec 2021 09:45:21 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A6=AA=E3=81=8C=E9=80=80=E4=BC=9A=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F=EF=BC=8B=E9=80=80?= =?UTF-8?q?=E4=BC=9A=E6=99=82=E3=83=80=E3=83=9F=E3=83=BCPDF=E3=81=8B?= =?UTF-8?q?=E7=94=BB=E5=83=8F=E3=81=8C=E3=81=82=E3=82=8C=E3=81=B0=E3=80=81?= =?UTF-8?q?=E3=83=AF=E3=83=BC=E3=83=8B=E3=83=B3=E3=82=B0=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/Api/ChildrenController.php | 2 +- .../app/Http/Controllers/Api/FathersController.php | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/app/Http/Controllers/Api/ChildrenController.php b/backend/app/Http/Controllers/Api/ChildrenController.php index ae4db10d..7f632fba 100644 --- a/backend/app/Http/Controllers/Api/ChildrenController.php +++ b/backend/app/Http/Controllers/Api/ChildrenController.php @@ -553,7 +553,7 @@ class ChildrenController extends Controller { $img = $child->image; $child->delete(); - if (!is_null($img)) { + if (!is_null($img) && $img != '/assets/default/avatar.jpg') { $img = str_replace('/files/', '', $child->image); if (!Storage::disk('private')->exists($img)) { Log::warning($img.'というパスは不正です。'); diff --git a/backend/app/Http/Controllers/Api/FathersController.php b/backend/app/Http/Controllers/Api/FathersController.php index 48a71ca5..0fc3f8f7 100644 --- a/backend/app/Http/Controllers/Api/FathersController.php +++ b/backend/app/Http/Controllers/Api/FathersController.php @@ -533,15 +533,22 @@ class FathersController extends Controller { if ($meet->count() > 0) { foreach ($meet->get() as $n) { $meim = MeetingImage::where('meeting_id', (int)$n->id); - $oldpdf = str_replace('/files/', '', $n->pdf); - $pdfs[] = $oldpdf; + if (!is_null($n->pdf) && $n->pdf != '/assets/default/default.pdf') { + $oldpdf = str_replace('/files/', '', $n->pdf); + $pdfs[] = $oldpdf; + } if ($meim->count() > 0) { foreach ($meim->get() as $m) { + if (is_null($n->pdf) || $m->image == '/assets/img/dummy/post-dummy01.jpg') { + continue; + } $oldimg = str_replace('/files/', '', $m->image); $images[] = $oldimg; } } + + $meim->delete(); } } @@ -550,9 +557,8 @@ class FathersController extends Controller { $father->delete(); $rel->delete(); $meet->delete(); - $meim->delete(); - if (!is_null($img)) { + if (!is_null($img) && $img != '/assets/default/avatar.jpg') { $img = str_replace('/files/', '', $father->image); if (!Storage::disk('private')->exists($img)) { Log::warning($img.'というパスは不正です。');