このコミットが含まれているのは:
守矢諏訪子 2021-11-03 20:46:48 +09:00
コミット b535ff8c9c
3個のファイルの変更32行の追加15行の削除

ファイルの表示

@ -264,8 +264,11 @@ class ChildrenController extends Controller {
}
public function detail (Request $r, $child_id) {
if (!isset($child_id)) {
return ['status_code' => 400];
}
$child_select = ['email', 'tel', 'last_name', 'first_name', 'identity', 'image', 'company'];
$father_relation_select = ['hire_at'];
// 親詳細の取得に成功
if (null === ($params = Child::select($child_select)->where('id', (int)$child_id)->first())) {

ファイルの表示

@ -59,6 +59,20 @@ class MeetingApprovalsController extends Controller {
return ['status_code' => 400, 'error_messages' => ['承認に失敗しました。']];
}
$create = [
'child_id' => $r->child_id,
'meeting_id' => $r->meeting_id,
'approval_at' => date('Y-m-d H:i:s'),
];
try {
MeetingApprovals::create($create);
} catch (\Throwable $e) {
// 失敗
Log::critical($e->getMessage());
return ['status_code' => 400, 'error_messages' => ['承認に失敗しました。']];
}
return ['status_code' => 200, 'success_messages' => ['承認しました。']];
}

ファイルの表示

@ -144,19 +144,19 @@ class MeetingsController extends Controller {
foreach ($approval as $a) {
if (null === ($list = Meeting::select($meeting_select)->where('id', (int)$a->meeting_id)->get())) {
return ['status_code' => 400];
$list = [];
}
foreach ($list as $i => $l) {
$result[] = $l;
if (null === ($result[$i]['meeting_images'] = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) {
return ['status_code' => 400];
$result[$i]['meeting_images'] = [];
}
if (null === ($result[$i]['fathers'] = Father::select($father_select)->where('id', (int)$l->father_id)->get())) {
return ['status_code' => 400];
$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())) {
return ['status_code' => 400];
$result[$i]['meeting_approvals'] = [];
}
}
}
@ -182,19 +182,19 @@ class MeetingsController extends Controller {
foreach ($approval as $a) {
if (null === ($list = Meeting::select($meeting_select)->where('id', (int)$a->meeting_id)->get())) {
return ['status_code' => 400];
$list = [];
}
foreach ($list as $i => $l) {
$result[] = $l;
if (null === ($result[$i]['meeting_images'] = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$l->id)->get())) {
return ['status_code' => 400];
$result[$i]['meeting_images'] = [];
}
if (null === ($result[$i]['fathers'] = Father::select($father_select)->where('id', (int)$l->father_id)->get())) {
return ['status_code' => 400];
$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())) {
return ['status_code' => 400];
$result[$i]['meeting_approvals'] = [];
}
}
}
@ -345,16 +345,16 @@ class MeetingsController extends Controller {
// 取得に成功
if (null === ($list = Meeting::select($meeting_select)->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]['father'] = Father::select($father_select)->where('id', (int)$l->father_id)->first())) {
return ['status_code' => 400];
$result[$i]['father'] = [];
}
if (null === ($result[$i]['approval'] = MeetingApprovals::select($meeting_approvals_select)->where('child_id', (int)$r->child_id)->whereNotNull('approval_at')->get())) {
return ['status_code' => 400];
$result[$i]['approval'] = [];
}
}
@ -373,16 +373,16 @@ class MeetingsController extends Controller {
// 取得に成功
if (null === ($list = Meeting::select($meeting_select)->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]['father'] = Father::select($father_select)->where('id', (int)$l->father_id)->first())) {
return ['status_code' => 400];
$result[$i]['father'] = [];
}
if (null === ($result[$i]['approval'] = MeetingApprovals::select($meeting_approvals_select)->where('child_id', (int)$r->child_id)->whereNull('approval_at')->get())) {
return ['status_code' => 400];
$result[$i]['approval'] = [];
}
}