From 59a62734415ffb356e0b84eda5dc102c7af684d5 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: Sat, 30 Oct 2021 19:02:09 +0900 Subject: [PATCH 1/6] =?UTF-8?q?listOfFather=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/Api/ChildrenController.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/app/Http/Controllers/Api/ChildrenController.php b/backend/app/Http/Controllers/Api/ChildrenController.php index 3347b04e..47efdd5a 100644 --- a/backend/app/Http/Controllers/Api/ChildrenController.php +++ b/backend/app/Http/Controllers/Api/ChildrenController.php @@ -180,17 +180,20 @@ class ChildrenController extends Controller { return ['status_code' => 200, 'params' => $result]; } - public function listOfFather (Request $r) { + public function listOfFather ($father_id) { + if (!isset($father_id)) { + return ['status_code' => 400]; + } $result = []; - $child_select = ['id', 'image', 'last_name', 'first_name']; + $child_select = ['first_name', 'last_name', 'tel']; - if (null === ($list = FatherRelation::select('father_id')->where('father_id', (int)$r->father_id)->orderBy('created_at', 'desc')->get())) { + if (null === ($list = FatherRelation::select('child_id')->where('father_id', (int)$father_id)->orderBy('created_at', 'desc')->get())) { return ['status_code' => 400]; } - foreach ($list as $l) { - if (null === ($result[] = Child::select($child_select)->find($l->father_id))) { - return ['status_code' => 400]; + foreach ($list as $i => $l) { + if (null === ($result[] = Child::select($child_select)->where('id', $l->child_id)->first())) { + $result[$i] = []; } } From edcaf09dfcfc1be36b85d163c2730730b483bfe4 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: Mon, 1 Nov 2021 15:18:40 +0900 Subject: [PATCH 2/6] =?UTF-8?q?$chk=E3=81=AE=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/Http/Controllers/Api/MeetingsController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index 51247f10..e13be01f 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -528,10 +528,12 @@ class MeetingsController extends Controller { $pdf = base64_decode(substr($r->pdf, strpos($r->pdf, ',') + 1)); $update['pdf'] = '/storage/'.$filename; - if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first() && strcmp($chk->pdf, $r->pdf) != 0) { - if (Storage::disk('public')->exists($chk->pdf)) { - if (Storage::disk('public')->get($chk->pdf) != $pdf) { - Storage::disk('public')->delete($chk->pdf); + if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) { + if (strcmp($chk->pdf, $r->pdf) != 0) { + if (Storage::disk('public')->exists($chk->pdf)) { + if (Storage::disk('public')->get($chk->pdf) != $pdf) { + Storage::disk('public')->delete($chk->pdf); + } } } } From 374d662032d823c14cfbd64b307b55e046001ba9 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: Mon, 1 Nov 2021 15:19:14 +0900 Subject: [PATCH 3/6] =?UTF-8?q?nginx=E3=81=AEclient=5Fmax=5Fbody=5Fsize?= =?UTF-8?q?=E3=81=AE=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/nginx/default.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/infra/nginx/default.conf b/infra/nginx/default.conf index a4cc9ba9..9734145a 100644 --- a/infra/nginx/default.conf +++ b/infra/nginx/default.conf @@ -10,6 +10,7 @@ server { index index.php; charset utf-8; + client_max_body_size 10M; location / { try_files $uri $uri/ /index.php?$query_string; From fcc2f9eb0458d9cc6505b25161682757a0d710d2 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: Mon, 1 Nov 2021 16:06:39 +0900 Subject: [PATCH 4/6] . --- .../app/Http/Controllers/Api/MeetingsController.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index e13be01f..640fd16b 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -529,16 +529,17 @@ class MeetingsController extends Controller { $update['pdf'] = '/storage/'.$filename; if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) { - if (strcmp($chk->pdf, $r->pdf) != 0) { + if (strcmp($chk->pdf, $pdf) !== 0) { if (Storage::disk('public')->exists($chk->pdf)) { - if (Storage::disk('public')->get($chk->pdf) != $pdf) { - Storage::disk('public')->delete($chk->pdf); - } + Storage::disk('public')->delete($chk->pdf); } + + Storage::disk('public')->put($filename, $pdf); } } - - Storage::disk('public')->put($filename, $pdf); + else { + Storage::disk('public')->put($filename, $pdf); + } } Meeting::where('id', (int)$meeting_id)->update($update); From 12052e4189316fbf8de454f4bff9a5a2d2311f9d 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: Mon, 1 Nov 2021 16:23:03 +0900 Subject: [PATCH 5/6] =?UTF-8?q?=E5=AE=8C=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/Http/Controllers/Api/MeetingsController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index 640fd16b..95f64422 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -526,18 +526,20 @@ class MeetingsController extends Controller { if (isset($r->pdf)) { $filename = uniqid() . '.pdf'; $pdf = base64_decode(substr($r->pdf, strpos($r->pdf, ',') + 1)); - $update['pdf'] = '/storage/'.$filename; if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) { - if (strcmp($chk->pdf, $pdf) !== 0) { - if (Storage::disk('public')->exists($chk->pdf)) { - Storage::disk('public')->delete($chk->pdf); + $opdf = str_replace('storage/', '', $chk->pdf); + if (strcmp(Storage::disk('public')->get($opdf), $pdf) !== 0) { + if (Storage::disk('public')->exists($opdf)) { + Storage::disk('public')->delete($opdf); } + $update['pdf'] = '/storage/'.$filename; Storage::disk('public')->put($filename, $pdf); } } else { + $update['pdf'] = '/storage/'.$filename; Storage::disk('public')->put($filename, $pdf); } } From d08efeef2012dd4fb06fe19202a1f98ca4816a94 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: Mon, 1 Nov 2021 17:44:00 +0900 Subject: [PATCH 6/6] / --- backend/app/Http/Controllers/Api/MeetingsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index 95f64422..b9fd33bf 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -528,7 +528,7 @@ class MeetingsController extends Controller { $pdf = base64_decode(substr($r->pdf, strpos($r->pdf, ',') + 1)); if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) { - $opdf = str_replace('storage/', '', $chk->pdf); + $opdf = str_replace('/storage/', '', $chk->pdf); if (strcmp(Storage::disk('public')->get($opdf), $pdf) !== 0) { if (Storage::disk('public')->exists($opdf)) { Storage::disk('public')->delete($opdf);