検索は一覧と一致にする

このコミットが含まれているのは:
守矢諏訪子 2021-11-16 16:05:00 +09:00
コミット a5e91c8963
1個のファイルの変更19行の追加29行の削除

ファイルの表示

@ -230,7 +230,6 @@ class MeetingsController extends Controller {
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at', 'is_favorite'];
$meeting_approvals_select = ['child_id', 'approval_at'];
$child_select = ['image'];
$father_relation_select = ['id'];
// 取得に成功
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)$r->father_id)->get())) {
@ -263,7 +262,6 @@ class MeetingsController extends Controller {
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at', 'is_favorite'];
$meeting_approvals_select = ['child_id', 'approval_at'];
$child_select = ['image'];
$father_relation_select = ['id'];
// 取得に成功
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)$r->father_id)->get())) {
@ -425,8 +423,7 @@ class MeetingsController extends Controller {
}
$result = [];
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at'];
$meeting_images_select = ['image'];
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at', 'is_favorite'];
$meeting_approvals_select = ['approval_at', 'child_id'];
$child_select = ['image'];
@ -436,20 +433,17 @@ class MeetingsController extends Controller {
}
foreach ($list as $i => $l) {
if (null === ($l->meeting_image = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) {
$l->meeting_image = [];
}
if (null !== ($l->approval = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->whereNull('approval_at')->first())) {
if (null === ($l->approval->child = Child::select($child_select)->where('id', (int)$l->approval->child_id)->first())) {
$l->approval->child = new \stdClass();
if (null !== ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->whereNull('approval_at')->where('meeting_id', (int)$l->id)->get())) {
foreach ($l->approvals as $ii => $ll) {
if (null === ($ll->child = Child::select($child_select)->where('id', (int)$ll->child_id)->first())) {
$ll->child = new \stdClass();
}
if (!in_array($l, $result)) {
$result[] = $l;
}
}
}
else {
$l->approval = new \stdClass();
$l->approval->child = new \stdClass();
}
$result[] = $l;
}
return ['status_code' => 200, 'params' => $result];
@ -462,7 +456,6 @@ class MeetingsController extends Controller {
$result = [];
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'updated_at', 'is_favorite'];
$meeting_images_select = ['image'];
$meeting_approvals_select = ['approval_at', 'child_id'];
$child_select = ['image'];
@ -472,20 +465,17 @@ class MeetingsController extends Controller {
}
foreach ($list as $i => $l) {
if (null === ($l->meeting_image = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) {
$l->meeting_image = [];
}
if (null !== ($l->approval = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->whereNotNull('approval_at')->first())) {
if (null === ($l->approval->child = Child::select($child_select)->where('id', (int)$l->approval->child_id)->first())) {
$l->approval->child = new \stdClass();
if (null !== ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->get())) {
foreach ($l->approvals as $ii => $ll) {
if (null === ($ll->child = Child::select($child_select)->where('id', (int)$ll->child_id)->first())) {
$ll->child = new \stdClass();
}
if (!in_array($l, $result)) {
$result[] = $l;
}
}
}
else {
$l->approval = new \stdClass();
$l->approval->child = new \stdClass();
}
$result[] = $l;
}
return ['status_code' => 200, 'params' => $result];