From 183568ec807d84a995571eba5a592317671bf385 Mon Sep 17 00:00:00 2001 From: Nathan <nat.che@hotmail.fr> Date: Wed, 25 Mar 2020 11:17:34 +0100 Subject: [PATCH] Auto stash before merge of "master" and "origin/master" --- Seance5-6/seance/index.php | 4 ++++ .../seance/src/controller/IndexController.php | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Seance5-6/seance/index.php b/Seance5-6/seance/index.php index fea1236..c028f9c 100644 --- a/Seance5-6/seance/index.php +++ b/Seance5-6/seance/index.php @@ -25,6 +25,10 @@ $app->get('/api/games/',function() { IndexController::partie2(); })->name('partie2'); +$app->get('/api/games/:id/comments',function() { + IndexController::partie5(); +})->name('partie5'); + diff --git a/Seance5-6/seance/src/controller/IndexController.php b/Seance5-6/seance/src/controller/IndexController.php index 9688da3..ee94bb7 100644 --- a/Seance5-6/seance/src/controller/IndexController.php +++ b/Seance5-6/seance/src/controller/IndexController.php @@ -62,5 +62,22 @@ class IndexController $cq2->render();*/ } + public static function partie5($id){ + $comment = Commentary::select('id', 'titre', 'contenu', 'dateCreation', 'userID')->where('jeuConcerne', '=', $id)->get(); + + $json = '{ "comments" : ['; + foreach ($comment as $c){ + + if($c === array_key_last($$comment)){ + $json = $json . ']}'; + }else{ + $json = $json . json_encode($c) . ','; + } + + } + + $vue = new VuePartie2($json); + $vue->render(); + } } \ No newline at end of file -- GitLab