Game-Jaming/Backend/Controllers/Registration/UpdateRegistration.php

28 lines
770 B
PHP

<?php
require_once "../../../bootstrap.php";
require_once "../Group/Group.php";
use Backend\Models\Registration;
if(isLogin()){
if(isset($_POST['updateReg'])){
if($reg = Registration::where("group_id", $_POST["groupId"])->where("game_jam_id", $_POST["gameJamId"])->first()){
$reg->group_amount = $_POST["groupAmount"];
if($reg->save()){
http_response_code(200);
}else{
http_response_code(500);
}
}else{
http_response_code(400);
echo json_encode(["message" => "registration does not exits"]);
}
}else{
http_response_code(400);
}
}else{
http_response_code(401);
echo json_encode(["message" => "is not login"]);
}