From 319da650af3865c3a7aa039fe5405d7ee40e898a 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, 6 Nov 2021 14:22:12 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fathers=E2=86=92father?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/Http/Controllers/Api/MeetingsController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index 5e997adc..1316c80a 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -151,8 +151,8 @@ class MeetingsController extends Controller { if (null === ($l->meeting_images = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) { $l->meeting_images = []; } - if (null === ($l->fathers = Father::select($father_select)->where('id', (int)$l->father_id)->first())) { - $l->fathers = new \stdClass(); + if (null === ($l->father = Father::select($father_select)->where('id', (int)$l->father_id)->first())) { + $l->father = new \stdClass(); } if (null === ($l->meeting_approvals = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) { $l->meeting_approvals = []; @@ -189,8 +189,8 @@ class MeetingsController extends Controller { if (null === ($l->meeting_images = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) { $l->meeting_images = []; } - if (null === ($l->fathers = Father::select($father_select)->where('id', (int)$l->father_id)->first())) { - $l->fathers = new \stdClass(); + if (null === ($l->father = Father::select($father_select)->where('id', (int)$l->father_id)->first())) { + $l->father = new \stdClass(); } if (null === ($l->meeting_approvals = MeetingApprovals::select($meeting_approvals_select)->whereNull('approval_at')->where('meeting_id', (int)$l->id)->orderBy('approval_at', 'asc')->get())) { $l->meeting_approvals = []; From 5829ef86de4da9086f9445b0cb9ba595bac8df89 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, 6 Nov 2021 14:33:19 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E8=87=AA=E5=88=86=E3=81=AE=E8=A6=AA?= =?UTF-8?q?=E3=81=A0=E3=81=91=E3=82=92=E8=A6=8B=E3=81=88=E3=82=8B=E6=A7=98?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Api/MeetingsController.php | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/backend/app/Http/Controllers/Api/MeetingsController.php b/backend/app/Http/Controllers/Api/MeetingsController.php index 1316c80a..c0857b04 100644 --- a/backend/app/Http/Controllers/Api/MeetingsController.php +++ b/backend/app/Http/Controllers/Api/MeetingsController.php @@ -151,8 +151,10 @@ class MeetingsController extends Controller { if (null === ($l->meeting_images = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) { $l->meeting_images = []; } - if (null === ($l->father = Father::select($father_select)->where('id', (int)$l->father_id)->first())) { - $l->father = new \stdClass(); + if (null !== ($fr = FatherRelation::select('father_id')->where('child_id', (int)$r->child_id)->first())) { + if (null === ($l->father = Father::select($father_select)->where('id', (int)$fr->father_id)->first())) { + $l->father = new \stdClass(); + } } if (null === ($l->meeting_approvals = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) { $l->meeting_approvals = []; @@ -189,8 +191,10 @@ class MeetingsController extends Controller { if (null === ($l->meeting_images = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) { $l->meeting_images = []; } - if (null === ($l->father = Father::select($father_select)->where('id', (int)$l->father_id)->first())) { - $l->father = new \stdClass(); + if (null !== ($fr = FatherRelation::select('father_id')->where('child_id', (int)$r->child_id)->first())) { + if (null === ($l->father = Father::select($father_select)->where('id', (int)$fr->father_id)->first())) { + $l->father = new \stdClass(); + } } if (null === ($l->meeting_approvals = MeetingApprovals::select($meeting_approvals_select)->whereNull('approval_at')->where('meeting_id', (int)$l->id)->orderBy('approval_at', 'asc')->get())) { $l->meeting_approvals = []; @@ -351,8 +355,10 @@ class MeetingsController extends Controller { } foreach ($list as $i => $l) { - if (null === ($l->father = Father::select($father_select)->where('id', (int)$l->father_id)->first())) { - $l->father = []; + if (null !== ($fr = FatherRelation::select('father_id')->where('child_id', (int)$r->child_id)->first())) { + if (null === ($l->father = Father::select($father_select)->where('id', (int)$fr->father_id)->first())) { + $l->father = new \stdClass(); + } } if (null === ($l->approval = MeetingApprovals::select($meeting_approvals_select)->where('child_id', (int)$r->child_id)->whereNotNull('approval_at')->get())) { $l->approval = []; @@ -379,8 +385,10 @@ class MeetingsController extends Controller { } foreach ($list as $i => $l) { - if (null === ($l->father = Father::select($father_select)->where('id', (int)$l->father_id)->first())) { - $l->father = []; + if (null !== ($fr = FatherRelation::select('father_id')->where('child_id', (int)$r->child_id)->first())) { + if (null === ($l->father = Father::select($father_select)->where('id', (int)$fr->father_id)->first())) { + $l->father = new \stdClass(); + } } if (null === ($l->approval = MeetingApprovals::select($meeting_approvals_select)->where('child_id', (int)$r->child_id)->whereNull('approval_at')->get())) { $l->approval = [];