From a31ed44bdd46bb5ea73f10d20f5e3065ee5bfc76 Mon Sep 17 00:00:00 2001 From: neerholt Date: Thu, 11 Mar 2021 14:22:19 +0100 Subject: [PATCH] fixed some stuff in gamejam --- Backend/Controllers/FileHandler/GetGameData.php | 3 ++- Backend/Controllers/GameJam/GetGameJam.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Backend/Controllers/FileHandler/GetGameData.php b/Backend/Controllers/FileHandler/GetGameData.php index 9081906..0eb147c 100644 --- a/Backend/Controllers/FileHandler/GetGameData.php +++ b/Backend/Controllers/FileHandler/GetGameData.php @@ -11,7 +11,8 @@ if(isset($_GET['gameDataId'])){ }elseif(isset($_GET['groupId'])){ $openGameDataStream = Group::find($_GET['groupId'])->GameData(); }elseif (isset($_GET['gameJamId'])){ - $openGameDataStream = Group::where("game_jam_id",$_GET['gameJamId'])->GameData();/*->pluck("id")->toArray()*/; + $gameDataIds = Group::where("game_jam_id",$_GET['gameJamId'])->pluck("game_data_id")->toArray(); + $openGameDataStream = GameData::whereIn("id", $gameDataIds)->get(); }else{ $openGameDataStream = GameData::all(); } diff --git a/Backend/Controllers/GameJam/GetGameJam.php b/Backend/Controllers/GameJam/GetGameJam.php index 0d3be10..12d62c6 100644 --- a/Backend/Controllers/GameJam/GetGameJam.php +++ b/Backend/Controllers/GameJam/GetGameJam.php @@ -2,6 +2,12 @@ require_once "../../../bootstrap.php"; use Backend\Models\GameJam; -$dbValue = GameJam::all()->toJson(JSON_PRETTY_PRINT); + +if(isset($_GET['gameJamId'])){ + $dbValue = GameJam::find($_GET['gameJamId']); +}else{ + $dbValue = GameJam::all(); +} + header('Content-Type: application/json;charset=UTF-8'); -echo $dbValue; \ No newline at end of file +echo $dbValue->toJson(JSON_PRETTY_PRINT); \ No newline at end of file