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

21 lines
725 B
PHP

<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Max-Age: 1000");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Origin, Cache-Control, Pragma, Authorization, Accept, Accept-Encoding");
header("Access-Control-Allow-Methods: PUT, POST, GET, OPTIONS, DELETE");
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('Content-Type: application/json;charset=UTF-8');
echo json_encode(array('data' => $dbValue->jsonSerialize()));
//var_dump(headers_list());