@@ -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', |
@@ -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'); |
@@ -17,7 +17,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | [ |