@@ -10,101 +10,101 @@ |
||
10 | 10 | use \App\Lib\DsManager\Models\Orm\Coach; |
11 | 11 | |
12 | 12 | $configuration = [ |
13 | - 'settings' => [ |
|
14 | - 'displayErrorDetails' => true, |
|
15 | - ], |
|
13 | + 'settings' => [ |
|
14 | + 'displayErrorDetails' => true, |
|
15 | + ], |
|
16 | 16 | ]; |
17 | 17 | $c = new \Slim\Container($configuration); |
18 | 18 | $api = new \Slim\App($c); |
19 | 19 | |
20 | 20 | $api->get('/ping', function ($request, $response, $args) { |
21 | - $jsonResp = json_encode( |
|
22 | - [ |
|
23 | - "status" => "service up", |
|
24 | - "message" => "in a bottle", |
|
25 | - "config" => \App\Lib\Helpers\Config::get("config1.stuff") |
|
26 | - ] |
|
27 | - ); |
|
28 | - return Responder::getJsonResponse($jsonResp, $response); |
|
21 | + $jsonResp = json_encode( |
|
22 | + [ |
|
23 | + "status" => "service up", |
|
24 | + "message" => "in a bottle", |
|
25 | + "config" => \App\Lib\Helpers\Config::get("config1.stuff") |
|
26 | + ] |
|
27 | + ); |
|
28 | + return Responder::getJsonResponse($jsonResp, $response); |
|
29 | 29 | }); |
30 | 30 | |
31 | 31 | $api->get('/players', function ($request, $response, $args) { |
32 | - $json = json_encode(Player::all()); |
|
33 | - return Responder::getJsonResponse($json, $response); |
|
32 | + $json = json_encode(Player::all()); |
|
33 | + return Responder::getJsonResponse($json, $response); |
|
34 | 34 | }); |
35 | 35 | |
36 | 36 | |
37 | 37 | $api->get('/players/{id}', function ($request, $response, $args) { |
38 | - return Responder::getJsonResponse( |
|
39 | - Player::findOrFail($args['id']), |
|
40 | - $response |
|
41 | - ); |
|
38 | + return Responder::getJsonResponse( |
|
39 | + Player::findOrFail($args['id']), |
|
40 | + $response |
|
41 | + ); |
|
42 | 42 | }); |
43 | 43 | |
44 | 44 | $api->get('/coaches', function ($request, $response, $args) { |
45 | - return Responder::getJsonResponse( |
|
46 | - Coach::all(), |
|
47 | - $response |
|
48 | - ); |
|
45 | + return Responder::getJsonResponse( |
|
46 | + Coach::all(), |
|
47 | + $response |
|
48 | + ); |
|
49 | 49 | }); |
50 | 50 | |
51 | 51 | $api->get('/teams', function ($request, $response, $args) { |
52 | - return Responder::getJsonResponse( |
|
53 | - Team::all(), |
|
54 | - $response |
|
55 | - ); |
|
52 | + return Responder::getJsonResponse( |
|
53 | + Team::all(), |
|
54 | + $response |
|
55 | + ); |
|
56 | 56 | }); |
57 | 57 | |
58 | 58 | $api->get('/teams/{id}', function ($request, $response, $args) { |
59 | - return Responder::getJsonResponse( |
|
60 | - Team::with( |
|
61 | - 'roster', |
|
62 | - 'coach' |
|
63 | - )->where( |
|
64 | - [ |
|
65 | - 'id' => $args['id'] |
|
66 | - ] |
|
67 | - )->get(), |
|
68 | - $response |
|
69 | - ); |
|
59 | + return Responder::getJsonResponse( |
|
60 | + Team::with( |
|
61 | + 'roster', |
|
62 | + 'coach' |
|
63 | + )->where( |
|
64 | + [ |
|
65 | + 'id' => $args['id'] |
|
66 | + ] |
|
67 | + )->get(), |
|
68 | + $response |
|
69 | + ); |
|
70 | 70 | }); |
71 | 71 | |
72 | 72 | $api->get('/teams/{id}/players', function ($request, $response, $args) { |
73 | - return Responder::getJsonResponse( |
|
74 | - Team::with( |
|
75 | - 'roster' |
|
76 | - )->where( |
|
77 | - [ |
|
78 | - 'id' => $args['id'] |
|
79 | - ] |
|
80 | - )->get(), |
|
81 | - $response |
|
82 | - ); |
|
73 | + return Responder::getJsonResponse( |
|
74 | + Team::with( |
|
75 | + 'roster' |
|
76 | + )->where( |
|
77 | + [ |
|
78 | + 'id' => $args['id'] |
|
79 | + ] |
|
80 | + )->get(), |
|
81 | + $response |
|
82 | + ); |
|
83 | 83 | }); |
84 | 84 | |
85 | 85 | $api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) { |
86 | - return Responder::getJsonResponse( |
|
87 | - Player::where( |
|
88 | - [ |
|
89 | - 'id' => $args['playerId'], |
|
90 | - 'team_id' => $args['id'] |
|
91 | - ] |
|
92 | - )->get(), |
|
93 | - $response |
|
94 | - ); |
|
86 | + return Responder::getJsonResponse( |
|
87 | + Player::where( |
|
88 | + [ |
|
89 | + 'id' => $args['playerId'], |
|
90 | + 'team_id' => $args['id'] |
|
91 | + ] |
|
92 | + )->get(), |
|
93 | + $response |
|
94 | + ); |
|
95 | 95 | }); |
96 | 96 | |
97 | 97 | $api->get('/teams/{id}/coach', function ($request, $response, $args) { |
98 | - return Responder::getJsonResponse( |
|
99 | - Team::with( |
|
100 | - 'coach' |
|
101 | - )->where( |
|
102 | - [ |
|
103 | - 'id' => $args['id'] |
|
104 | - ] |
|
105 | - )->get(), |
|
106 | - $response |
|
107 | - ); |
|
98 | + return Responder::getJsonResponse( |
|
99 | + Team::with( |
|
100 | + 'coach' |
|
101 | + )->where( |
|
102 | + [ |
|
103 | + 'id' => $args['id'] |
|
104 | + ] |
|
105 | + )->get(), |
|
106 | + $response |
|
107 | + ); |
|
108 | 108 | }); |
109 | 109 | |
110 | 110 | $api->run(); |
111 | 111 | \ No newline at end of file |
@@ -5,19 +5,19 @@ |
||
5 | 5 | |
6 | 6 | class CreateTeamTable |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function run() |
|
14 | - { |
|
15 | - Capsule::schema()->dropIfExists('teams'); |
|
16 | - Capsule::schema()->create('teams', function (Blueprint $table) { |
|
17 | - $table->increments('id'); |
|
18 | - $table->string('name'); |
|
19 | - $table->string('nationality',2); |
|
20 | - $table->timestamps(); |
|
21 | - }); |
|
22 | - } |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function run() |
|
14 | + { |
|
15 | + Capsule::schema()->dropIfExists('teams'); |
|
16 | + Capsule::schema()->create('teams', function (Blueprint $table) { |
|
17 | + $table->increments('id'); |
|
18 | + $table->string('name'); |
|
19 | + $table->string('nationality',2); |
|
20 | + $table->timestamps(); |
|
21 | + }); |
|
22 | + } |
|
23 | 23 | } |
@@ -13,10 +13,10 @@ |
||
13 | 13 | public function run() |
14 | 14 | { |
15 | 15 | Capsule::schema()->dropIfExists('teams'); |
16 | - Capsule::schema()->create('teams', function (Blueprint $table) { |
|
16 | + Capsule::schema()->create('teams', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('name'); |
19 | - $table->string('nationality',2); |
|
19 | + $table->string('nationality', 2); |
|
20 | 20 | $table->timestamps(); |
21 | 21 | }); |
22 | 22 | } |
@@ -5,35 +5,35 @@ |
||
5 | 5 | |
6 | 6 | class CreateCoachesTable |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function run() |
|
14 | - { |
|
15 | - Capsule::schema()->dropIfExists('coaches'); |
|
16 | - Capsule::schema()->create('coaches', function (Blueprint $table) { |
|
17 | - $table->increments('id'); |
|
18 | - $table->string('name'); |
|
19 | - $table->string('surname'); |
|
20 | - $table->tinyInteger('age'); |
|
21 | - $table->string('nationality',2); |
|
22 | - $table->float('skillAvg'); |
|
23 | - $table->float('wageReq'); |
|
24 | - $table->string('favouriteModule',10); |
|
25 | - $table->integer('team_id')->nullable(); |
|
26 | - $table->timestamps(); |
|
27 | - }); |
|
28 | - } |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function run() |
|
14 | + { |
|
15 | + Capsule::schema()->dropIfExists('coaches'); |
|
16 | + Capsule::schema()->create('coaches', function (Blueprint $table) { |
|
17 | + $table->increments('id'); |
|
18 | + $table->string('name'); |
|
19 | + $table->string('surname'); |
|
20 | + $table->tinyInteger('age'); |
|
21 | + $table->string('nationality',2); |
|
22 | + $table->float('skillAvg'); |
|
23 | + $table->float('wageReq'); |
|
24 | + $table->string('favouriteModule',10); |
|
25 | + $table->integer('team_id')->nullable(); |
|
26 | + $table->timestamps(); |
|
27 | + }); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Reverse the migrations. |
|
32 | - * |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - public function down() |
|
36 | - { |
|
37 | - Schema::drop('coaches'); |
|
38 | - } |
|
30 | + /** |
|
31 | + * Reverse the migrations. |
|
32 | + * |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + public function down() |
|
36 | + { |
|
37 | + Schema::drop('coaches'); |
|
38 | + } |
|
39 | 39 | } |
@@ -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 | }); |
@@ -5,26 +5,26 @@ |
||
5 | 5 | |
6 | 6 | class CreatePlayersTable |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function run() |
|
14 | - { |
|
15 | - Capsule::schema()->dropIfExists('players'); |
|
16 | - Capsule::schema()->create('players', function (Blueprint $table) { |
|
17 | - $table->increments('id'); |
|
18 | - $table->string('name'); |
|
19 | - $table->string('surname'); |
|
20 | - $table->tinyInteger('age'); |
|
21 | - $table->string('nationality',2); |
|
22 | - $table->float('skillAvg'); |
|
23 | - $table->float('wageReq'); |
|
24 | - $table->float('val'); |
|
25 | - $table->string('role',2); |
|
26 | - $table->integer('team_id')->nullable(); |
|
27 | - $table->timestamps(); |
|
28 | - }); |
|
29 | - } |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function run() |
|
14 | + { |
|
15 | + Capsule::schema()->dropIfExists('players'); |
|
16 | + Capsule::schema()->create('players', function (Blueprint $table) { |
|
17 | + $table->increments('id'); |
|
18 | + $table->string('name'); |
|
19 | + $table->string('surname'); |
|
20 | + $table->tinyInteger('age'); |
|
21 | + $table->string('nationality',2); |
|
22 | + $table->float('skillAvg'); |
|
23 | + $table->float('wageReq'); |
|
24 | + $table->float('val'); |
|
25 | + $table->string('role',2); |
|
26 | + $table->integer('team_id')->nullable(); |
|
27 | + $table->timestamps(); |
|
28 | + }); |
|
29 | + } |
|
30 | 30 | } |
@@ -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 | }); |
@@ -10,14 +10,14 @@ |
||
10 | 10 | */ |
11 | 11 | $capsule = new Capsule; |
12 | 12 | $capsule->addConnection(array( |
13 | - 'driver' => 'mysql', |
|
14 | - 'host' => 'localhost', |
|
15 | - 'database' => 'dsmanager', |
|
16 | - 'username' => empty(getenv('USERNAME')) ? 'root' : getenv('USERNAME'), |
|
17 | - 'password' => empty(getenv('PASSWORD')) ? '' : getenv('PASSWORD'), |
|
18 | - 'charset' => 'utf8', |
|
19 | - 'collation' => 'utf8_general_ci', |
|
20 | - 'prefix' => '' |
|
13 | + 'driver' => 'mysql', |
|
14 | + 'host' => 'localhost', |
|
15 | + 'database' => 'dsmanager', |
|
16 | + 'username' => empty(getenv('USERNAME')) ? 'root' : getenv('USERNAME'), |
|
17 | + 'password' => empty(getenv('PASSWORD')) ? '' : getenv('PASSWORD'), |
|
18 | + 'charset' => 'utf8', |
|
19 | + 'collation' => 'utf8_general_ci', |
|
20 | + 'prefix' => '' |
|
21 | 21 | )); |
22 | 22 | $capsule->setAsGlobal(); |
23 | 23 | $capsule->bootEloquent(); |
@@ -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 | /** |