一覧、検索、気に入り

このコミットが含まれているのは:
守矢諏訪子 2021-11-16 18:02:03 +09:00
コミット 661a7409a6
1個のファイルの変更84行の追加48行の削除

ファイルの表示

@ -237,15 +237,21 @@ class MeetingsController extends Controller {
}
foreach ($list as $i => $l) {
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 (null === ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->get())) {
continue;
}
if (!in_array($l, $result)) {
$result[] = $l;
}
if (count($l->approvals->toArray()) != MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->count()) {
continue;
}
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;
}
}
}
@ -269,15 +275,21 @@ class MeetingsController extends Controller {
}
foreach ($list as $i => $l) {
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 (null === ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->get())) {
continue;
}
if (!in_array($l, $result)) {
$result[] = $l;
}
if (count($l->approvals) == MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->count()) {
continue;
}
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;
}
}
}
@ -297,21 +309,27 @@ class MeetingsController extends Controller {
// 取得に成功
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)$r->father_id)->where('is_favorite', 1)->get())) {
$list = [];
return ['status_code' => 400];
}
foreach ($list as $i => $l) {
if (null === ($l->approval = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
$l->approval = [];
if (null === ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
continue;
}
foreach ($l->approval as $ii => $ra) {
if (null === ($l->approval[$ii]['child'] = Child::select($child_select)->where('id', (int)$l->approval[$ii]['child_id'])->first())) {
$l->approval[$ii]['child'] = [];
if (count($l->approvals->toArray()) != MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->count()) {
continue;
}
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;
}
}
$result[] = $l;
}
return ['status_code' => 200, 'params' => $result];
@ -329,21 +347,27 @@ class MeetingsController extends Controller {
// 取得に成功
if (null === ($list = Meeting::select($meeting_select)->where('father_id', (int)$r->father_id)->where('is_favorite', 0)->get())) {
$list = [];
return ['status_code' => 400];
}
foreach ($list as $i => $l) {
if (null === ($l->approval = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
$l->approval = [];
if (null === ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->orderBy('updated_at', 'desc')->get())) {
continue;
}
foreach ($l->approval as $ii => $ra) {
if (null === ($l->approval[$ii]['child'] = Child::select($child_select)->where('id', (int)$l->approval[$ii]['child_id'])->first())) {
$l->approval[$ii]['child'] = [];
if (count($l->approvals) == MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->count()) {
continue;
}
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;
}
}
$result[] = $l;
}
return ['status_code' => 200, 'params' => $result];
@ -433,15 +457,21 @@ class MeetingsController extends Controller {
}
foreach ($list as $i => $l) {
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 (null === ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->get())) {
continue;
}
if (!in_array($l, $result)) {
$result[] = $l;
}
if (count($l->approvals->toArray()) != MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->count()) {
continue;
}
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;
}
}
}
@ -465,15 +495,21 @@ class MeetingsController extends Controller {
}
foreach ($list as $i => $l) {
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 (null === ($l->approvals = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$l->id)->get())) {
continue;
}
if (!in_array($l, $result)) {
$result[] = $l;
}
if (count($l->approvals) == MeetingApprovals::select($meeting_approvals_select)->whereNotNull('approval_at')->where('meeting_id', (int)$l->id)->count()) {
continue;
}
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;
}
}
}