back end update
This commit is contained in:
@@ -1 +1,20 @@
|
||||
<?php
|
||||
require_once "../../../bootstrap.php";
|
||||
|
||||
use Backend\Models\Registration;
|
||||
|
||||
if(isset($_GET["registrationId"])){
|
||||
$regs = Registration::find($_GET["registrationId"]);
|
||||
} elseif (isset($_GET["groupId"])){
|
||||
$regs = Registration::where("group_id", $_GET["groupId"])->get();
|
||||
} elseif (isset($_GET["gameJamId"])){
|
||||
$regs = Registration::where("game_jam_id", $_GET["gameJamId"])->get();
|
||||
}elseif (isset($_GET["gameDataId"])){
|
||||
$regs = Registration::where("game_data_id", $_GET["gameDataId"])->get();
|
||||
}else{
|
||||
$regs = Registration::all();
|
||||
}
|
||||
header("Access-Control-Allow-Methods: GET");
|
||||
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
|
||||
header('Content-Type: application/json;charset=UTF-8');
|
||||
echo json_encode(array('data' => $regs->jsonSerialize()));
|
||||
@@ -6,7 +6,7 @@ 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()){
|
||||
if($reg = Registration::find($_POST["registrationId"])->where("group_id", groupViaToken($_SESSION['token'])->id)->first()){
|
||||
$reg->group_amount = $_POST["groupAmount"];
|
||||
if($reg->save()){
|
||||
http_response_code(200);
|
||||
|
||||
Reference in New Issue
Block a user