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

16 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-Origin: *");
header("Access-Control-Allow-Methods: GET");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
header('Content-Type: application/json;charset=UTF-8');
echo $dbValue->toJson(JSON_PRETTY_PRINT);