Game-Jaming/Backend/Controllers/GameJam/NewGameJam.php

30 lines
712 B
PHP

<?php
require_once "../../../bootstrap.php";
require_once "../Admin/Admin.php";
use Backend\Models\GameJam;
//var_dump($_POST);
//session_start();
if(isAdmin()){
if(isset($_POST['newGameJam'])){
$gameJam = New GameJam();
$gameJam->name = $_POST["gameJamName"];
$gameJam->start_time = $_POST["startDate"]."T".$_POST["startTime"];
$gameJam->end_time = $_POST["endDate"]."T".$_POST["endTime"];
$gameJam->description = $_POST["description"];
if($gameJam->save()){
http_response_code(201);
}
else{
http_response_code(500);
}
}else{
http_response_code(400);
}
}else{
http_response_code(401);
}