GameData(); }elseif (isset($_GET['gameJamId'])){ $gameDataIds = Group::where("game_jam_id",$_GET['gameJamId'])->pluck("game_data_id")->toArray(); $openGameDataStream = GameData::whereIn("id", $gameDataIds)->get(); }else{ $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'); echo $openGameDataStream->toJson(JSON_PRETTY_PRINT);