子供側の受取の修正
このコミットが含まれているのは:
コミット
58a8da9ede
|
@ -138,7 +138,7 @@ class MeetingsController extends Controller {
|
|||
$meeting_approvals_select = ['approval_at'];
|
||||
|
||||
// 取得に成功
|
||||
if (null === ($approval = MeetingApprovals::select('meeting_id')->where('child_id', (int)$r->child_id)->whereNotNull('approval_at')->orderBy('updated_at', 'desc')->get())) {
|
||||
if (null === ($approval = MeetingApprovals::select('meeting_id')->where('child_id', (int)1)->whereNotNull('approval_at')->orderBy('updated_at', 'desc')->get())) {
|
||||
return ['status_code' => 400];
|
||||
}
|
||||
|
||||
|
@ -148,16 +148,16 @@ class MeetingsController extends Controller {
|
|||
}
|
||||
|
||||
foreach ($list as $i => $l) {
|
||||
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)->get())) {
|
||||
$l->fathers = [];
|
||||
}
|
||||
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 = [];
|
||||
}
|
||||
$result[] = $l;
|
||||
if (null === ($result[$i]['meeting_images'] = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) {
|
||||
$result[$i]['meeting_images'] = [];
|
||||
}
|
||||
if (null === ($result[$i]['fathers'] = Father::select($father_select)->where('id', (int)$l->father_id)->get())) {
|
||||
$result[$i]['fathers'] = [];
|
||||
}
|
||||
if (null === ($result[$i]['meeting_approvals'] = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
|
||||
$result[$i]['meeting_approvals'] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,16 +186,16 @@ class MeetingsController extends Controller {
|
|||
}
|
||||
|
||||
foreach ($list as $i => $l) {
|
||||
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)->get())) {
|
||||
$l->fathers = [];
|
||||
}
|
||||
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 = [];
|
||||
}
|
||||
$result[] = $l;
|
||||
if (null === ($result[$i]['meeting_images'] = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) {
|
||||
$result[$i]['meeting_images'] = [];
|
||||
}
|
||||
if (null === ($result[$i]['fathers'] = Father::select($father_select)->where('id', (int)$l->father_id)->get())) {
|
||||
$result[$i]['fathers'] = [];
|
||||
}
|
||||
if (null === ($result[$i]['meeting_approvals'] = MeetingApprovals::select($meeting_approvals_select)->whereNull('approval_at')->where('meeting_id', (int)$l->id)->orderBy('approval_at', 'asc')->get())) {
|
||||
$result[$i]['meeting_approvals'] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,20 +283,21 @@ class MeetingsController extends Controller {
|
|||
|
||||
// 取得に成功
|
||||
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)$r->father_id)->where('is_favorite', 1)->get())) {
|
||||
return ['status_code' => 400];
|
||||
$list = [];
|
||||
}
|
||||
|
||||
foreach ($list as $i => $l) {
|
||||
$result[] = $l;
|
||||
if (null === ($result[$i]['approvals'] = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
|
||||
return ['status_code' => 400];
|
||||
if (null === ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
|
||||
$l->approvals = [];
|
||||
}
|
||||
|
||||
foreach ($result[$i]['approvals'] as $ii => $ra) {
|
||||
if (null === ($result[$i]['approvals'][$ii]['child'] = Child::select($child_select)->where('id', (int)$result[$i]['approvals'][$ii]['child_id'])->first())) {
|
||||
return ['status_code' => 400];
|
||||
foreach ($l->approvals as $ii => $ra) {
|
||||
if (null === ($l->approvals[$ii]['child'] = Child::select($child_select)->where('id', (int)$l->approvals[$ii]['child_id'])->first())) {
|
||||
$l->approvals[$ii]['child'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = $l;
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
|
@ -314,20 +315,21 @@ class MeetingsController extends Controller {
|
|||
|
||||
// 取得に成功
|
||||
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)$r->father_id)->where('is_favorite', 0)->get())) {
|
||||
return ['status_code' => 400];
|
||||
$list = [];
|
||||
}
|
||||
|
||||
foreach ($list as $i => $l) {
|
||||
$result[] = $l;
|
||||
if (null === ($result[$i]['approvals'] = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
|
||||
return ['status_code' => 400];
|
||||
if (null === ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
|
||||
$l->approvals = [];
|
||||
}
|
||||
|
||||
foreach ($result[$i]['approvals'] as $ii => $ra) {
|
||||
if (null === ($result[$i]['approvals'][$ii]['child'] = Child::select($child_select)->where('id', (int)$result[$i]['approvals'][$ii]['child_id'])->first())) {
|
||||
return ['status_code' => 400];
|
||||
foreach ($l->approvals as $ii => $ra) {
|
||||
if (null === ($l->approvals[$ii]['child'] = Child::select($child_select)->where('id', (int)$l->approvals[$ii]['child_id'])->first())) {
|
||||
$l->approvals[$ii]['child'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = $l;
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
|
@ -349,13 +351,13 @@ 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 === ($l->approval = MeetingApprovals::select($meeting_approvals_select)->where('child_id', (int)$r->child_id)->whereNotNull('approval_at')->get())) {
|
||||
$l->approval = [];
|
||||
}
|
||||
$result[] = $l;
|
||||
if (null === ($result[$i]['father'] = Father::select($father_select)->where('id', (int)$l->father_id)->first())) {
|
||||
$result[$i]['father'] = [];
|
||||
}
|
||||
if (null === ($result[$i]['approval'] = MeetingApprovals::select($meeting_approvals_select)->where('child_id', (int)$r->child_id)->whereNotNull('approval_at')->get())) {
|
||||
$result[$i]['approval'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
|
@ -377,13 +379,13 @@ 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 === ($l->approval = MeetingApprovals::select($meeting_approvals_select)->where('child_id', (int)$r->child_id)->whereNull('approval_at')->get())) {
|
||||
$l->approval = [];
|
||||
}
|
||||
$result[] = $l;
|
||||
if (null === ($result[$i]['father'] = Father::select($father_select)->where('id', (int)$l->father_id)->first())) {
|
||||
$result[$i]['father'] = [];
|
||||
}
|
||||
if (null === ($result[$i]['approval'] = MeetingApprovals::select($meeting_approvals_select)->where('child_id', (int)$r->child_id)->whereNull('approval_at')->get())) {
|
||||
$result[$i]['approval'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
|
@ -402,23 +404,24 @@ class MeetingsController extends Controller {
|
|||
|
||||
// 取得に成功
|
||||
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)$r->father_id)->where('title', 'LIKE', '%'.$r->keyword.'%')->orWhere('text', 'LIKE', '%'.$r->keyword.'%')->get())) {
|
||||
return ['status_code' => 400];
|
||||
$list = [];
|
||||
}
|
||||
|
||||
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 === ($l->meeting_image = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) {
|
||||
$l->meeting_image = [];
|
||||
}
|
||||
if (null == ($result[$i]['meeting_approvals'] = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->whereNull('approval_at')->get())) {
|
||||
return ['status_code' => 400];
|
||||
if (null === ($l->meeting_approvals = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->whereNull('approval_at')->get())) {
|
||||
$l->meeting_approvals = [];
|
||||
}
|
||||
|
||||
foreach ($result[$i]['meeting_approvals'] as $ii => $ra) {
|
||||
if (null == ($result[$i]['meeting_approvals'][$ii]['child'] = Child::select($child_select)->where('id', (int)$result[$i]['meeting_approvals'][$ii]['child_id'])->first())) {
|
||||
return ['status_code' => 400];
|
||||
foreach ($l->meeting_approvals as $ii => $ra) {
|
||||
if (null == ($l->meeting_approvals[$ii]['child'] = Child::select($child_select)->where('id', (int)$result[$i]['meeting_approvals'][$ii]['child_id'])->first())) {
|
||||
$l->meeting_approvals[$ii]['child'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = $l;
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
|
@ -437,23 +440,24 @@ class MeetingsController extends Controller {
|
|||
|
||||
// 取得に成功
|
||||
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)$r->father_id)->where('title', 'LIKE', '%'.$r->keyword.'%')->orWhere('text', 'LIKE', '%'.$r->keyword.'%')->get())) {
|
||||
return ['status_code' => 400];
|
||||
$list = [];
|
||||
}
|
||||
|
||||
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 === ($l->meeting_image = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) {
|
||||
$l->meeting_image = [];
|
||||
}
|
||||
if (null === ($result[$i]['meeting_approvals'] = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->whereNotNull('approval_at')->get())) {
|
||||
return ['status_code' => 400];
|
||||
if (null === ($l->meeting_approvals = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->whereNotNull('approval_at')->get())) {
|
||||
$l->meeting_approvals = [];
|
||||
}
|
||||
|
||||
foreach ($result[$i]['meeting_approvals'] as $ii => $ra) {
|
||||
if (null === ($result[$i]['meeting_approvals'][$ii]['child'] = Child::select($child_select)->where('id', (int)$result[$i]['meeting_approvals'][$ii]['child_id'])->first())) {
|
||||
return ['status_code' => 400];
|
||||
foreach ($l->meeting_approvals as $ii => $ra) {
|
||||
if (null == ($l->meeting_approvals[$ii]['child'] = Child::select($child_select)->where('id', (int)$result[$i]['meeting_approvals'][$ii]['child_id'])->first())) {
|
||||
$l->meeting_approvals[$ii]['child'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
$result[] = $l;
|
||||
}
|
||||
|
||||
return ['status_code' => 200, 'params' => $result];
|
||||
|
|
新しいイシューから参照