@@ -13,15 +13,15 @@ |
||
13 | 13 | public function run() |
14 | 14 | { |
15 | 15 | Capsule::schema()->dropIfExists('coaches'); |
16 | - Capsule::schema()->create('coaches', function (Blueprint $table) { |
|
16 | + Capsule::schema()->create('coaches', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->string('surname'); |
20 | 20 | $table->tinyInteger('age'); |
21 | - $table->string('nationality',2); |
|
21 | + $table->string('nationality', 2); |
|
22 | 22 | $table->float('skillAvg'); |
23 | 23 | $table->float('wageReq'); |
24 | - $table->string('favouriteModule',10); |
|
24 | + $table->string('favouriteModule', 10); |
|
25 | 25 | $table->integer('team_id')->nullable(); |
26 | 26 | $table->timestamps(); |
27 | 27 | }); |
@@ -13,16 +13,16 @@ |
||
13 | 13 | public function run() |
14 | 14 | { |
15 | 15 | Capsule::schema()->dropIfExists('players'); |
16 | - Capsule::schema()->create('players', function (Blueprint $table) { |
|
16 | + Capsule::schema()->create('players', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->string('surname'); |
20 | 20 | $table->tinyInteger('age'); |
21 | - $table->string('nationality',2); |
|
21 | + $table->string('nationality', 2); |
|
22 | 22 | $table->float('skillAvg'); |
23 | 23 | $table->float('wageReq'); |
24 | 24 | $table->float('val'); |
25 | - $table->string('role',2); |
|
25 | + $table->string('role', 2); |
|
26 | 26 | $table->integer('team_id')->nullable(); |
27 | 27 | $table->timestamps(); |
28 | 28 | }); |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | use Illuminate\Database\Capsule\Manager as Capsule; |
4 | 4 | |
5 | -$dotenv = new Dotenv\Dotenv(__DIR__ . "/../"); |
|
5 | +$dotenv = new Dotenv\Dotenv(__DIR__."/../"); |
|
6 | 6 | $dotenv->load(); |
7 | 7 | |
8 | 8 | /** |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function run() |
14 | 14 | { |
15 | 15 | Capsule::schema()->dropIfExists('matches'); |
16 | - Capsule::schema()->create('matches', function (Blueprint $table) { |
|
16 | + Capsule::schema()->create('matches', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('home_team_id'); |
19 | 19 | $table->integer('goal_home')->default(0); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | return $this->belongsTo(Team::class, 'away_team_id'); |
57 | 57 | } |
58 | 58 | |
59 | - public function scopeComplete($query){ |
|
59 | + public function scopeComplete($query) { |
|
60 | 60 | return $query->with( |
61 | 61 | 'homeTeam', |
62 | 62 | 'homeTeam.roster', |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function run() |
14 | 14 | { |
15 | 15 | Capsule::schema()->dropIfExists('match_players'); |
16 | - Capsule::schema()->create('match_players', function (Blueprint $table) { |
|
16 | + Capsule::schema()->create('match_players', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('match_id'); |
19 | 19 | $table->integer('team_id'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function run() |
14 | 14 | { |
15 | 15 | Capsule::schema()->dropIfExists('leagues'); |
16 | - Capsule::schema()->create('leagues', function (Blueprint $table) { |
|
16 | + Capsule::schema()->create('leagues', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->timestamps(); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $c = new \Slim\Container($configuration); |
22 | 22 | $api = new \Slim\App($c); |
23 | 23 | |
24 | -$api->get('/ping', function ($request, $response, $args) { |
|
24 | +$api->get('/ping', function($request, $response, $args) { |
|
25 | 25 | $jsonResp = json_encode( |
26 | 26 | [ |
27 | 27 | "status" => "service up", |
@@ -31,34 +31,34 @@ discard block |
||
31 | 31 | return Responder::getJsonResponse($jsonResp, $response); |
32 | 32 | }); |
33 | 33 | |
34 | -$api->get('/players', function ($request, $response, $args) { |
|
34 | +$api->get('/players', function($request, $response, $args) { |
|
35 | 35 | $json = json_encode(Player::all()); |
36 | 36 | return Responder::getJsonResponse($json, $response); |
37 | 37 | }); |
38 | 38 | |
39 | 39 | |
40 | -$api->get('/players/{id}', function ($request, $response, $args) { |
|
40 | +$api->get('/players/{id}', function($request, $response, $args) { |
|
41 | 41 | return Responder::getJsonResponse( |
42 | 42 | Player::findOrFail($args['id']), |
43 | 43 | $response |
44 | 44 | ); |
45 | 45 | }); |
46 | 46 | |
47 | -$api->get('/coaches', function ($request, $response, $args) { |
|
47 | +$api->get('/coaches', function($request, $response, $args) { |
|
48 | 48 | return Responder::getJsonResponse( |
49 | 49 | Coach::all(), |
50 | 50 | $response |
51 | 51 | ); |
52 | 52 | }); |
53 | 53 | |
54 | -$api->get('/teams', function ($request, $response, $args) { |
|
54 | +$api->get('/teams', function($request, $response, $args) { |
|
55 | 55 | return Responder::getJsonResponse( |
56 | 56 | Team::all(), |
57 | 57 | $response |
58 | 58 | ); |
59 | 59 | }); |
60 | 60 | |
61 | -$api->get('/teams/{id}', function ($request, $response, $args) { |
|
61 | +$api->get('/teams/{id}', function($request, $response, $args) { |
|
62 | 62 | return Responder::getJsonResponse( |
63 | 63 | Team::complete() |
64 | 64 | ->where( |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ); |
71 | 71 | }); |
72 | 72 | |
73 | -$api->get('/teams/{id}/players', function ($request, $response, $args) { |
|
73 | +$api->get('/teams/{id}/players', function($request, $response, $args) { |
|
74 | 74 | return Responder::getJsonResponse( |
75 | 75 | Team::with( |
76 | 76 | 'roster' |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ); |
84 | 84 | }); |
85 | 85 | |
86 | -$api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) { |
|
86 | +$api->get('/teams/{id}/players/{playerId}', function($request, $response, $args) { |
|
87 | 87 | return Responder::getJsonResponse( |
88 | 88 | Player::statistics()->where( |
89 | 89 | [ |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | }); |
97 | 97 | |
98 | -$api->get('/teams/{id}/coach', function ($request, $response, $args) { |
|
98 | +$api->get('/teams/{id}/coach', function($request, $response, $args) { |
|
99 | 99 | return Responder::getJsonResponse( |
100 | 100 | Team::with( |
101 | 101 | 'coach' |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | ); |
109 | 109 | }); |
110 | 110 | |
111 | -$api->get('/leagues', function ($request, $response, $args) { |
|
111 | +$api->get('/leagues', function($request, $response, $args) { |
|
112 | 112 | return Responder::getJsonResponse( |
113 | 113 | League::all(), |
114 | 114 | $response |
115 | 115 | ); |
116 | 116 | }); |
117 | 117 | |
118 | -$api->get('/leagues/{id}', function ($request, $response, $args) { |
|
118 | +$api->get('/leagues/{id}', function($request, $response, $args) { |
|
119 | 119 | return Responder::getJsonResponse( |
120 | 120 | League::with('rounds') |
121 | 121 | ->where( |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $response |
127 | 127 | ); |
128 | 128 | }); |
129 | -$api->get('/leagues/{id}/rounds/{roundId}/matches', function ($request, $response, $args) { |
|
129 | +$api->get('/leagues/{id}/rounds/{roundId}/matches', function($request, $response, $args) { |
|
130 | 130 | return Responder::getJsonResponse( |
131 | 131 | Match::teams() |
132 | 132 | ->where( |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | $response |
138 | 138 | ); |
139 | 139 | }); |
140 | -$api->get('/matches', function ($request, $response, $args) { |
|
140 | +$api->get('/matches', function($request, $response, $args) { |
|
141 | 141 | return Responder::getJsonResponse( |
142 | 142 | Match::teams()->get(), |
143 | 143 | $response |
144 | 144 | ); |
145 | 145 | }); |
146 | 146 | |
147 | -$api->post('/matches', function ($request, $response, $args) { |
|
147 | +$api->post('/matches', function($request, $response, $args) { |
|
148 | 148 | $json = $request->getBody(); |
149 | 149 | $json = json_decode($json, true); |
150 | 150 | return Responder::getJsonResponse( |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ); |
156 | 156 | }); |
157 | 157 | |
158 | -$api->get('/matches/{id}', function ($request, $response, $args) { |
|
158 | +$api->get('/matches/{id}', function($request, $response, $args) { |
|
159 | 159 | return Responder::getJsonResponse( |
160 | 160 | Match::complete() |
161 | 161 | ->where( |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ); |
168 | 168 | }); |
169 | 169 | |
170 | -$api->get('/matches/{id}/result', function ($request, $response, $args) { |
|
170 | +$api->get('/matches/{id}/result', function($request, $response, $args) { |
|
171 | 171 | $result = MatchResult::complete() |
172 | 172 | ->where( |
173 | 173 | [ |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | ); |
182 | 182 | }); |
183 | 183 | |
184 | -$api->put('/matches/{id}/simulate', function ($request, $response, $args) { |
|
184 | +$api->put('/matches/{id}/simulate', function($request, $response, $args) { |
|
185 | 185 | return Responder::getJsonResponse( |
186 | 186 | MatchSimulator::simulate( |
187 | 187 | $args['id'] |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public function run() |
14 | 14 | { |
15 | 15 | Capsule::schema()->dropIfExists('league_rounds'); |
16 | - Capsule::schema()->create('league_rounds', function (Blueprint $table) { |
|
16 | + Capsule::schema()->create('league_rounds', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->integer('league_id'); |
19 | 19 | $table->integer('day')->default(0); |