From bfa0c997ff5d2c18ff2aa336fbd10ad123c7d512 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: Sun, 31 Oct 2021 01:42:13 +0900 Subject: [PATCH] ... --- .../Controllers/Api/MeetingsController.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index 7ebb02ed..426a273e 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -469,23 +469,20 @@ class MeetingsController extends Controller { $child_select = ['image', 'last_name', 'first_name']; // 取得に成功 - if (null === ($list = Meeting::select($meeting_select)->where('id', $meeting_id)->where('father_id', (int)$r->father_id)->first())) { + if (null === ($result = Meeting::select($meeting_select)->where('id', $meeting_id)->where('father_id', (int)$r->father_id)->first())) { return ['status_code' => 400]; } - foreach ($list as $i => $l) { - $result[] = $l; - if (null === ($result[$i]['meeting_image'] = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) { - return ['status_code' => 400]; - } - if (null === ($result[$i]['approval'] = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->whereNotNull('approval_at')->get())) { - return ['status_code' => 400]; - } + if (null === ($result->meeting_image = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$result->id)->get())) { + return ['status_code' => 400]; + } + if (null === ($result->approval = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$result->id)->whereNotNull('approval_at')->get())) { + return ['status_code' => 400]; + } - foreach ($result[$i]['approval'] as $ii => $ra) { - if (null === ($result[$i]['approval'][$ii]['child'] = Child::select($child_select)->where('id', (int)$ra->child_id)->first())) { - return ['status_code' => 400]; - } + foreach ($result->approval as $i => $r) { + if (null === ($result->approval[$i]['child'] = Child::select($child_select)->where('id', (int)$r->child_id)->first())) { + return ['status_code' => 400]; } }