Completed
Push — master ( 36889c...d49014 )
by Vincenzo
02:54
created
api/index.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 $c = new \Slim\Container($configuration);
18 18
 $api = new \Slim\App($c);
19 19
 
20
-$api->get('/ping', function ($request, $response, $args) {
20
+$api->get('/ping', function($request, $response, $args) {
21 21
     $jsonResp = json_encode(
22 22
         [
23 23
             "status" => "service up",
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
     return Responder::getJsonResponse($jsonResp, $response);
28 28
 });
29 29
 
30
-$api->get('/players', function ($request, $response, $args) {
30
+$api->get('/players', function($request, $response, $args) {
31 31
     $json = json_encode(Player::all());
32 32
     return Responder::getJsonResponse($json, $response);
33 33
 });
34 34
 
35 35
 
36
-$api->get('/players/{id}', function ($request, $response, $args) {
36
+$api->get('/players/{id}', function($request, $response, $args) {
37 37
     return Responder::getJsonResponse(
38 38
         Player::findOrFail($args['id']),
39 39
         $response
40 40
     );
41 41
 });
42 42
 
43
-$api->get('/coaches', function ($request, $response, $args) {
43
+$api->get('/coaches', function($request, $response, $args) {
44 44
     return Responder::getJsonResponse(
45 45
         Coach::all(),
46 46
         $response
47 47
     );
48 48
 });
49 49
 
50
-$api->get('/teams', function ($request, $response, $args) {
50
+$api->get('/teams', function($request, $response, $args) {
51 51
     return Responder::getJsonResponse(
52 52
         Team::all(),
53 53
         $response
54 54
     );
55 55
 });
56 56
 
57
-$api->get('/teams/{id}', function ($request, $response, $args) {
57
+$api->get('/teams/{id}', function($request, $response, $args) {
58 58
     return Responder::getJsonResponse(
59 59
         Team::complete()
60 60
             ->where(
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     );
67 67
 });
68 68
 
69
-$api->get('/teams/{id}/players', function ($request, $response, $args) {
69
+$api->get('/teams/{id}/players', function($request, $response, $args) {
70 70
     return Responder::getJsonResponse(
71 71
         Team::with(
72 72
             'roster'
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
     );
80 80
 });
81 81
 
82
-$api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) {
82
+$api->get('/teams/{id}/players/{playerId}', function($request, $response, $args) {
83 83
     return Responder::getJsonResponse(
84
-        Player::with('matches','goals')->where(
84
+        Player::with('matches', 'goals')->where(
85 85
             [
86 86
                 'id' => $args['playerId'],
87 87
                 'team_id' => $args['id']
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     );
92 92
 });
93 93
 
94
-$api->get('/teams/{id}/coach', function ($request, $response, $args) {
94
+$api->get('/teams/{id}/coach', function($request, $response, $args) {
95 95
     return Responder::getJsonResponse(
96 96
         Team::with(
97 97
             'coach'
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     );
105 105
 });
106 106
 
107
-$api->get('/matches', function ($request, $response, $args) {
107
+$api->get('/matches', function($request, $response, $args) {
108 108
     return Responder::getJsonResponse(
109 109
         \App\Lib\DsManager\Models\Orm\Match::with(
110 110
             'homeTeam',
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     );
115 115
 });
116 116
 
117
-$api->post('/matches', function ($request, $response, $args) {
117
+$api->post('/matches', function($request, $response, $args) {
118 118
     $json = $request->getBody();
119 119
     $json = json_decode($json, true);
120 120
     return Responder::getJsonResponse(
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     );
126 126
 });
127 127
 
128
-$api->get('/matches/{id}', function ($request, $response, $args) {
128
+$api->get('/matches/{id}', function($request, $response, $args) {
129 129
     return Responder::getJsonResponse(
130 130
         \App\Lib\DsManager\Models\Orm\Match::complete()
131 131
             ->where(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     );
138 138
 });
139 139
 
140
-$api->get('/matches/{id}/result', function ($request, $response, $args) {
140
+$api->get('/matches/{id}/result', function($request, $response, $args) {
141 141
     $result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
142 142
         ->where(
143 143
             [
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     );
152 152
 });
153 153
 
154
-$api->put('/matches/{id}/simulate', function ($request, $response, $args) {
154
+$api->put('/matches/{id}/simulate', function($request, $response, $args) {
155 155
     $result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
156 156
         ->where(
157 157
             [
Please login to merge, or discard this patch.