diff --git a/backend/app/Http/Controllers/Api/MeetingApprovalsController.php b/backend/app/Http/Controllers/Api/MeetingApprovalsController.php index 2076a371..d4cd7a68 100644 --- a/backend/app/Http/Controllers/Api/MeetingApprovalsController.php +++ b/backend/app/Http/Controllers/Api/MeetingApprovalsController.php @@ -14,7 +14,7 @@ use App\Models\FatherRelation; class MeetingApprovalsController extends Controller { public function register (Request $r, $meeting_id) { if (!isset($meeting_id) || !isset($r->children) || count($r->children) == 0) { - return ['status' => 400]; + return ['status_code' => 400]; } // 承知登録に失敗 @@ -40,7 +40,7 @@ class MeetingApprovalsController extends Controller { public function delete ($meeting_id) { if (!isset($meeting_id)) { - return ['status' => 400]; + return ['status_code' => 400]; } try { @@ -55,7 +55,7 @@ class MeetingApprovalsController extends Controller { public function registerApproval (Request $r) { if (!isset($r->meeting_id) || !isset($r->child_id)) { - return ['status' => 400, 'error_messages' => ['承認に失敗しました。']]; + return ['status_code' => 400, 'error_messages' => ['承認に失敗しました。']]; } if (null === (MeetingApprovals::where('id', (int)$r->meeting_id)->where('child_id', (int)$r->child_id)->first())) { @@ -67,7 +67,7 @@ class MeetingApprovalsController extends Controller { public function listChildrenOfMeeting (Request $r) { if (!isset($r->meeting_id) || !isset($r->child_id)) { - return ['status' => 400, 'error_messages' => ['承認に失敗しました。']]; + return ['status_code' => 400, 'error_messages' => ['承認に失敗しました。']]; } $meeting_approvals_select = ['id', 'child_id', 'approval_at']; @@ -75,7 +75,7 @@ class MeetingApprovalsController extends Controller { if (null === ($params = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$r->meeting_id)->where('child_id', (int)$r->child_id)->get())) { - return ['status' => 400, 'error_messages' => ['承認に失敗しました。']]; + return ['status_code' => 400, 'error_messages' => ['承認に失敗しました。']]; } try { @@ -86,7 +86,7 @@ class MeetingApprovalsController extends Controller { return ['status_code' => 400, 'error_messages' => ['登録に失敗しました。']]; } - return ['status' => 200, 'success_messages' => ['承認しました。']]; + return ['status_code' => 200, 'success_messages' => ['承認しました。']]; } public function listChildrenOfApprovel (Request $r) { @@ -99,16 +99,16 @@ class MeetingApprovalsController extends Controller { if (null === ($params = MeetingApprovals::select($meeting_approvals_select)->where('meeting_id', (int)$r->meeting_id)->whereNotNull('approval_at')->get())) { // エラーの場合 - return ['status' => 400]; + return ['status_code' => 400]; } foreach ($params as $p) { if (null === ($p->child_id = Child::select($child_select)->where('id', (int)$p->child_id)->first())) { - return ['status' => 400]; + return ['status_code' => 400]; } } - return ['status' => 200, 'params' => $params]; + return ['status_code' => 200, 'params' => $params]; } public function listChildrenOfUnapprovel (Request $r) { @@ -121,16 +121,16 @@ class MeetingApprovalsController extends Controller { if (null === ($params = MeetingApprovals::select($meeting_select)->where('meeting_id', (int)$r->meeting_id)->whereNull('approval_at')->get())) { // エラーの場合 - return ['status' => 400]; + return ['status_code' => 400]; } foreach ($params as $p) { if (null === ($p->child_id = Child::select($child_select)->where('id', (int)$p->child_id)->first())) { - return ['status' => 400]; + return ['status_code' => 400]; } } - return ['status' => 200, 'params' => $params]; + return ['status_code' => 200, 'params' => $params]; } public function deleteRelationMeeting ($meeting_id) { diff --git a/backend/app/Http/Controllers/Api/MeetingImagesController.php b/backend/app/Http/Controllers/Api/MeetingImagesController.php index 7d5b2e59..78879be8 100644 --- a/backend/app/Http/Controllers/Api/MeetingImagesController.php +++ b/backend/app/Http/Controllers/Api/MeetingImagesController.php @@ -13,11 +13,11 @@ use App\Models\MeetingImage; class MeetingImagesController extends Controller { public function register (Request $r) { if (!isset($r->meeting_id) || !isset($r->image)) { - return ['status' => 400]; + return ['status_code' => 400]; } if (MeetingImage::select('id')->where('meeting_id', (int)$r->meeting_id)->count() >= 10) { - return ['status' => 400]; + return ['status_code' => 400, 'error_messages' => 'エラーメッセージ']; } // ファイルサイズは10MiB以内 @@ -83,7 +83,7 @@ class MeetingImagesController extends Controller { return ['status_code' => 400]; } - if (null === ($get = MeetingImage::select('get')->where('id', (int)$image_id)->first())) { + if (null === ($get = MeetingImage::select('image')->where('id', (int)$image_id)->first())) { return ['status_code' => 400]; } @@ -96,6 +96,12 @@ class MeetingImagesController extends Controller { return ['status_code' => 400]; } - return ['status_code' => 200]; + $meeting_images_select = ['image']; + + if (null === ($params = MeetingImage::select($meeting_images_select)->where('meeting_id', (int)$r->meeting_id)->get())) { + return ['status_code' => 400]; + } + + return ['status_code' => 200, 'params' => $params]; } }