From 89f0c9b514cc351c4dd91c0b2f48535151095688 Mon Sep 17 00:00:00 2001
From: SASSU Thomas <thomas.sassu5@etu.univ-lorraine.fr>
Date: Tue, 24 Mar 2020 12:33:16 +0100
Subject: [PATCH] Partie 6 platforms

---
 GamePedia/index.php                          | 8 ++++++++
 GamePedia/src/controleurs/ControleurGame.php | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/GamePedia/index.php b/GamePedia/index.php
index 62540f3..9595c01 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 e5e3598..e45a380 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
-- 
GitLab