From 7aa379836c785496ffe24016312b637f31b913b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Sat, 18 Dec 2021 15:54:18 +0900 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=E8=A6=AA=E3=81=AErel=5Flim=E3=81=8C0?= =?UTF-8?q?=E3=81=AE=E9=9A=9B=E3=80=81=E7=94=BB=E9=9D=A2=E3=82=92=E9=81=B7?= =?UTF-8?q?=E7=A7=BB=E3=81=99=E3=82=8B=E3=81=A0=E3=81=91=E3=81=A7=E3=80=8C?= =?UTF-8?q?=E5=A4=B1=E6=95=97=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=8D?= =?UTF-8?q?=E3=81=A8=E3=82=A2=E3=83=A9=E3=83=BC=E3=83=88=E3=81=8C=E5=87=BA?= =?UTF-8?q?=E3=81=A6=E3=81=97=E3=81=BE=E3=81=84=E3=81=BE=E3=81=99=E3=80=82?= =?UTF-8?q?=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/Api/FatherRelationsController.php | 8 ++++++++ backend/routes/api.php | 1 + 2 files changed, 9 insertions(+) diff --git a/backend/app/Http/Controllers/Api/FatherRelationsController.php b/backend/app/Http/Controllers/Api/FatherRelationsController.php index ef739009..7b6bfdd6 100644 --- a/backend/app/Http/Controllers/Api/FatherRelationsController.php +++ b/backend/app/Http/Controllers/Api/FatherRelationsController.php @@ -15,6 +15,14 @@ use App\Models\Meeting; use App\Models\MeetingApprovals; class FatherRelationsController extends Controller { + public function check () { + if (FatherRelation::select('id')->where('father_id', (int)session()->get('fathers')['id'])->count() == 0) { + return ['status_code' => 401, 'error_messages' => ['契約上限数に達した為、メンバー追加できません。']]; + } + + return ['status_code' => 200]; + } + public function register (Request $r) { if (!isset($r->father_id)) { return ['status_code' => 400, 'error_messages' => ['子の追加に失敗しました。']]; diff --git a/backend/routes/api.php b/backend/routes/api.php index ede4de6d..f5fc959e 100644 --- a/backend/routes/api.php +++ b/backend/routes/api.php @@ -133,6 +133,7 @@ Route::group(['prefix' => 'fathers'], function () { // FatherRelationsController Route::group(['prefix' => 'relations'], function () { + Route::get('/check', '\App\Http\Controllers\Api\FatherRelationsController@check'); Route::post('/register', '\App\Http\Controllers\Api\FatherRelationsController@register'); Route::put('/updateHireDate/{child_id}', '\App\Http\Controllers\Api\FatherRelationsController@updateHireDate'); Route::delete('/deleteRelationChild/{child_id}', '\App\Http\Controllers\Api\FatherRelationsController@deleteRelationChild');