diff --git a/GamePedia/index.php b/GamePedia/index.php index 62540f37168a05dce0693ec2bd3045e911d7951e..9595c01a4bc663d0d075be6a7200caa20ae6496d 100644 --- a/GamePedia/index.php +++ b/GamePedia/index.php @@ -37,4 +37,12 @@ $app->get('/api/games/:id/comments',function ($id) { $c = new ControleurGame(); $c->getGameComments($id); }); +$app->get('/api/games/:id/characters',function ($id) { + $c = new ControleurGame(); + $c->getGameCharacters($id); +}); +$app->get('/api/games/:id/platforms',function ($id) { + $c = new ControleurGame(); + $c->getGamePlatforms($id); +}); $app->run(); \ No newline at end of file diff --git a/GamePedia/src/controleurs/ControleurGame.php b/GamePedia/src/controleurs/ControleurGame.php index e5e3598daad2d8c25e229ba37f1e99636ca8bbd1..e45a38038b67d85050923d2974b82cbd86a4b6ff 100644 --- a/GamePedia/src/controleurs/ControleurGame.php +++ b/GamePedia/src/controleurs/ControleurGame.php @@ -42,4 +42,11 @@ class ControleurGame $v = new VueGame(json_encode($comments)); $v->render('getComments'); } + + public function getGamePlatforms($id){ + $game = Game::where('id', '=', $id)->first(); + $platforms = $game->platforms()->get(); + $v = new VueGame(json_encode($platforms)); + $v->render('getPlatforms'); + } } \ No newline at end of file