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