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

20 lines
787 B
PHP
Raw Normal View History

2021-04-19 07:15:15 +00:00
<?php
2021-04-26 06:21:51 +00:00
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()));