Game-Jaming/Backend/Controllers/Group/UpdateGruop.php

29 lines
679 B
PHP

<?php
require_once "../../../bootstrap.php";
require_once "Group.php";
use Backend\Models\Group;
if(isLogin()){
if (isset($_POST['updateGroup'])) {
if($group = groupViaToken($_SESSION['token'])){
$group->group_name = $_POST['groupName'];
$group->group_amount = $_POST['groupAmount'];
$group->game_jam_id = $_POST['gameJamId'];
if(!$group->save()){
echo http_response_code(500);
}else{
echo http_response_code(201);
}
}
}else{
echo http_response_code(400);
}
}else{
echo http_response_code(401);
}