Added some headers
This commit is contained in:
parent
815ec2d499
commit
c1484e4710
|
@ -14,6 +14,7 @@ if(isset($_GET['gameDataId'])){
|
||||||
$openGameDataStream = GameData::all();
|
$openGameDataStream = GameData::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');
|
header('Content-Type: application/json;charset=UTF-8');
|
||||||
echo $openGameDataStream->toJson(JSON_PRETTY_PRINT);
|
echo $openGameDataStream->toJson(JSON_PRETTY_PRINT);
|
|
@ -9,8 +9,9 @@ if(isset($_GET['gameJamId'])){
|
||||||
$dbValue = GameJam::all();
|
$dbValue = GameJam::all();
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Access-Control-Allow-Origin: *");
|
|
||||||
header("Access-Control-Allow-Methods: GET");
|
header("Access-Control-Allow-Methods: GET");
|
||||||
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
|
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept");
|
||||||
header('Content-Type: application/json;charset=UTF-8');
|
header('Content-Type: application/json;charset=UTF-8');
|
||||||
echo $dbValue->toJson(JSON_PRETTY_PRINT);
|
echo $dbValue->toJson(JSON_PRETTY_PRINT);
|
||||||
|
|
||||||
|
//var_dump(headers_list());
|
|
@ -12,5 +12,7 @@ else{
|
||||||
$groups = Group::all();
|
$groups = Group::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');
|
header('Content-Type: application/json;charset=UTF-8');
|
||||||
echo $groups->toJson(JSON_PRETTY_PRINT);
|
echo $groups->toJson(JSON_PRETTY_PRINT);
|
|
@ -21,6 +21,9 @@ if(isAdmin() && isset($_GET['gameJamId'])){
|
||||||
$winningGroups->push($group);
|
$winningGroups->push($group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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');
|
header('Content-Type: application/json;charset=UTF-8');
|
||||||
echo $winningGroups->toJson(JSON_PRETTY_PRINT);
|
echo $winningGroups->toJson(JSON_PRETTY_PRINT);
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,16 @@ use \Backend\Models\GameJam;
|
||||||
use \Illuminate\Support\Collection;
|
use \Illuminate\Support\Collection;
|
||||||
|
|
||||||
if (!isAdmin()){
|
if (!isAdmin()){
|
||||||
if(isset($_POST['genKeyWord'])){
|
if(isset($_GET['genKeyWord'])){
|
||||||
$gameJamId = $_POST['gameJamId'];
|
$gameJamId = $_GET['gameJamId'];
|
||||||
$game_jam = GameJam::find($gameJamId);
|
$game_jam = GameJam::find($gameJamId);
|
||||||
$all_group_in_game_jam_id = Group::where("game_jam_id", $game_jam->id)->pluck("id")->toArray();
|
$all_group_in_game_jam_id = Group::where("game_jam_id", $game_jam->id)->pluck("id")->toArray();
|
||||||
$find_all_keywords = KeyWord::whereIn("group_id", $all_group_in_game_jam_id)->inRandomOrder()->get();
|
$find_all_keywords = KeyWord::whereIn("group_id", $all_group_in_game_jam_id)->inRandomOrder()->get();
|
||||||
$game_jam->key_word = $find_all_keywords->first()->key_word;
|
$game_jam->key_word = $find_all_keywords->first()->key_word;
|
||||||
$game_jam->save();
|
$game_jam->save();
|
||||||
|
|
||||||
|
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');
|
header('Content-Type: application/json;charset=UTF-8');
|
||||||
echo $find_all_keywords->pluck("key_word")->toJson(JSON_PRETTY_PRINT);
|
echo $find_all_keywords->pluck("key_word")->toJson(JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,21 @@ $gameJam = GameJam::firstOrCreate([
|
||||||
<input type="submit" name="login" value="login">
|
<input type="submit" name="login" value="login">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
//print_r(headers_list());
|
||||||
|
|
||||||
|
$h = apache_request_headers();
|
||||||
|
|
||||||
|
foreach ($h as $name => $value) {
|
||||||
|
echo "$name: $value <br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<br>";
|
||||||
|
|
||||||
|
var_dump(headers_list());
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -6,10 +6,14 @@ $(window).on("load", function(){
|
||||||
function dataFetch(){
|
function dataFetch(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "/Game-Jaming/Backend/Controllers/FileHandler/GetGameData.php?gameJamId=1",
|
url: "/Game-Jaming/Backend/controllers/GameJam/GetGameJam.php",
|
||||||
success: function(result){
|
success: function(result){
|
||||||
console.log(result);
|
console.log(result[0].name);
|
||||||
console.log(result[0].game_link)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//console.log(result.name); ?gameJamId=1
|
||||||
|
//console.log(result[0].name); uden ?gameJamId=1
|
Loading…
Reference in New Issue