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]; } }