From 2b5361cbd148502dc0f4ec926e9eb91ea4e34bd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tondon=20C=C3=A9sar?= <pilou.tondon@hotmail.fr>
Date: Wed, 25 Mar 2020 10:01:21 +0100
Subject: [PATCH] partie 2
---
.../seance/src/controller/IndexController.php | 48 ++++++++++---------
1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/Seance5-6/seance/src/controller/IndexController.php b/Seance5-6/seance/src/controller/IndexController.php
index 88db463..728087e 100644
--- a/Seance5-6/seance/src/controller/IndexController.php
+++ b/Seance5-6/seance/src/controller/IndexController.php
@@ -17,29 +17,31 @@ class IndexController
}
public static function partie2() {
- $game = Game::where('id','<=','200')->get();
- // $game = Game::where('id','=',1)->get();
- // $json = json_encode($game,JSON_FORCE_OBJECT);
- $json = '{ "games" : [ ';
- foreach($game as $key => $value) {
- $json = $json . '{
- "id": ' . $value->id . ',
- "name":' . $value->name . ',
- "deck":' . $value->deck . ',
- },
- ';
- if ($value->id == 200) {
- $json = $json . '{
- "id": ' . $value->id . ',
- "name":' . $value->name . ',
- "deck":' . $value->deck . ',
- }
- ';
- }
- }
- $json = $json . ']}';
- $cq2 = new VuePartie2($json);
- $cq2->render();
+ $game = Game::select('id','name','alias','deck')->where('id','<=','200')->get();
+ // $game = Game::where('id','=',1)->get();
+ // $json = json_encode($game,JSON_FORCE_OBJECT);
+ $json = '{ "games" : [ ';
+ foreach($game as $key => $value) {
+ $json = $json . json_encode($value) . ',';
+ /*$json = $json . '{
+ "id": ' . $value->id . ',
+ "name":' . $value->name . ',
+ "deck":' . $value->deck . ',
+ },
+ ';*/
+ if ($value->id == 200) {
+ $json = $json . json_encode($value);/*
+ $json = $json . '{
+ "id": ' . $value->id . ',
+ "name":' . $value->name . ',
+ "deck":' . $value->deck . ',
+ }
+ ';*/
+ }
+ }
+ $json = $json . ']}';
+ $cq2 = new VuePartie2($json);
+ $cq2->render();
}
}
\ No newline at end of file
--
GitLab