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

18 lines
502 B
PHP

<?php
require_once (realpath(dirname(__FILE__) ."/../../../bootstrap.php"));
use Backend\Models\GameJam;
if(isset($_GET['gameJamId'])){
$dbValue = GameJam::find($_GET['gameJamId']);
}else{
$dbValue = GameJam::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' => $dbValue->jsonSerialize()));
//var_dump(headers_list());