Completed
Push — master ( c27acc...5e9888 )
by Vincenzo
02:27
created
api/Lib/DsManager/Models/Orm/Player.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -9,70 +9,70 @@
 block discarded – undo
9 9
 class Player extends DsManagerOrm
10 10
 {
11 11
 
12
-    /**
13
-     * @var string
14
-     */
15
-    protected $table = 'players';
12
+	/**
13
+	 * @var string
14
+	 */
15
+	protected $table = 'players';
16 16
 
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $fillable = [
21
-        'name',
22
-        'surname',
23
-        'age',
24
-        'nationality',
25
-        'skillAvg',
26
-        'wageReq',
27
-        'val',
28
-        'role',
29
-        'team_id'
30
-    ];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $fillable = [
21
+		'name',
22
+		'surname',
23
+		'age',
24
+		'nationality',
25
+		'skillAvg',
26
+		'wageReq',
27
+		'val',
28
+		'role',
29
+		'team_id'
30
+	];
31 31
 
32
-    /**
33
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
34
-     */
35
-    public function team()
36
-    {
37
-        return $this->belongsTo(Team::class);
38
-    }
32
+	/**
33
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
34
+	 */
35
+	public function team()
36
+	{
37
+		return $this->belongsTo(Team::class);
38
+	}
39 39
 
40
-    public function lastMatches()
41
-    {
42
-        return $this->hasMany(MatchPlayer::class)
43
-            ->orderBy('updated_at', 'DESC')
44
-            ->limit(5);
45
-    }
40
+	public function lastMatches()
41
+	{
42
+		return $this->hasMany(MatchPlayer::class)
43
+			->orderBy('updated_at', 'DESC')
44
+			->limit(5);
45
+	}
46 46
 
47
-    public function goals()
48
-    {
49
-        return $this->hasOne(MatchPlayer::class)
50
-            ->selectRaw('player_id, sum(goals) as count')
51
-            ->groupBy('player_id');
52
-    }
47
+	public function goals()
48
+	{
49
+		return $this->hasOne(MatchPlayer::class)
50
+			->selectRaw('player_id, sum(goals) as count')
51
+			->groupBy('player_id');
52
+	}
53 53
 
54
-    public function appearances()
55
-    {
56
-        return $this->hasOne(MatchPlayer::class)
57
-            ->selectRaw('player_id, count(match_id) as count')
58
-            ->groupBy('player_id');
59
-    }
54
+	public function appearances()
55
+	{
56
+		return $this->hasOne(MatchPlayer::class)
57
+			->selectRaw('player_id, count(match_id) as count')
58
+			->groupBy('player_id');
59
+	}
60 60
 
61
-    public function avg()
62
-    {
63
-        return $this->hasOne(MatchPlayer::class)
64
-            ->selectRaw('player_id, round(avg(vote),2) as avg')
65
-            ->groupBy('player_id');
66
-    }
61
+	public function avg()
62
+	{
63
+		return $this->hasOne(MatchPlayer::class)
64
+			->selectRaw('player_id, round(avg(vote),2) as avg')
65
+			->groupBy('player_id');
66
+	}
67 67
 
68
-    public function scopeStatistics($query)
69
-    {
70
-        return $query->with(
71
-            'goals',
72
-            'appearances',
73
-            'avg',
74
-            'lastMatches',
75
-            'team'
76
-        );
77
-    }
68
+	public function scopeStatistics($query)
69
+	{
70
+		return $query->with(
71
+			'goals',
72
+			'appearances',
73
+			'avg',
74
+			'lastMatches',
75
+			'team'
76
+		);
77
+	}
78 78
 }
79 79
\ No newline at end of file
Please login to merge, or discard this patch.
api/database/migrations/CreateLeaguesTable.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,19 +5,19 @@
 block discarded – undo
5 5
 
6 6
 class CreateLeaguesTable
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function run()
14
-    {
15
-        Capsule::schema()->dropIfExists('leagues');
16
-        Capsule::schema()->create('leagues', function (Blueprint $table) {
17
-            $table->increments('id');
18
-            $table->string('name');
19
-            $table->unsignedTinyInteger('teams')->default(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('leagues');
16
+		Capsule::schema()->create('leagues', function (Blueprint $table) {
17
+			$table->increments('id');
18
+			$table->string('name');
19
+			$table->unsignedTinyInteger('teams')->default(2);
20
+			$table->timestamps();
21
+		});
22
+	}
23 23
 }
Please login to merge, or discard this patch.
api/database/seeds/A000TeamsSeeder.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,20 +3,20 @@
 block discarded – undo
3 3
 
4 4
 class ATeamsSeeder
5 5
 {
6
-    function run()
7
-    {
8
-        $teamNumber = 16;
9
-        $rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller();
10
-        for ($i = 1; $i <= $teamNumber; $i++) {
11
-            $team = $rndFiller->getTeam($rndFiller->getLocale());
12
-            $teamArray = $team->toArray();
13
-            $teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray);
14
-            foreach ($teamArray['roster'] as $player) {
15
-                $player['team_id'] = $teamO->id;
16
-                \App\Lib\DsManager\Models\Orm\Player::create($player);
17
-            }
18
-            $teamArray['coach']['team_id'] = $teamO->id;
19
-            \App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']);
20
-        }
21
-    }
6
+	function run()
7
+	{
8
+		$teamNumber = 16;
9
+		$rndFiller = new \App\Lib\DsManager\Helpers\RandomFiller();
10
+		for ($i = 1; $i <= $teamNumber; $i++) {
11
+			$team = $rndFiller->getTeam($rndFiller->getLocale());
12
+			$teamArray = $team->toArray();
13
+			$teamO = \App\Lib\DsManager\Models\Orm\Team::create($teamArray);
14
+			foreach ($teamArray['roster'] as $player) {
15
+				$player['team_id'] = $teamO->id;
16
+				\App\Lib\DsManager\Models\Orm\Player::create($player);
17
+			}
18
+			$teamArray['coach']['team_id'] = $teamO->id;
19
+			\App\Lib\DsManager\Models\Orm\Coach::create($teamArray['coach']);
20
+		}
21
+	}
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
api/index.php 3 patches
Unused Use Statements   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
4 4
 require_once("vendor/autoload.php");
5 5
 
6 6
 
7
-use App\Lib\DsManager\Helpers\MatchSimulator;
8
-use App\Lib\DsManager\Models\Orm\League;
9
-use App\Lib\DsManager\Models\Orm\Match;
7
+use App\Lib\DsManager\Helpers\MatchSimulator;
8
+use App\Lib\DsManager\Models\Orm\League;
9
+use App\Lib\DsManager\Models\Orm\Match;
10 10
 use App\Lib\DsManager\Models\Orm\MatchResult;
11 11
 use \App\Lib\Helpers\Responder;
12 12
 use \App\Lib\DsManager\Models\Orm\Player;
Please login to merge, or discard this patch.
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -14,190 +14,190 @@
 block discarded – undo
14 14
 use \App\Lib\DsManager\Models\Orm\Coach;
15 15
 
16 16
 $configuration = [
17
-    'settings' => [
18
-        'displayErrorDetails' => true,
19
-    ],
17
+	'settings' => [
18
+		'displayErrorDetails' => true,
19
+	],
20 20
 ];
21 21
 $c = new \Slim\Container($configuration);
22 22
 $api = new \Slim\App($c);
23 23
 
24 24
 $api->get('/ping', function ($request, $response, $args) {
25
-    $jsonResp = json_encode(
26
-        [
27
-            "status" => "service up",
28
-            "message" => "in a bottle"
29
-        ]
30
-    );
31
-    return Responder::getJsonResponse($jsonResp, $response);
25
+	$jsonResp = json_encode(
26
+		[
27
+			"status" => "service up",
28
+			"message" => "in a bottle"
29
+		]
30
+	);
31
+	return Responder::getJsonResponse($jsonResp, $response);
32 32
 });
33 33
 
34 34
 $api->get('/players', function ($request, $response, $args) {
35
-    $json = json_encode(Player::all());
36
-    return Responder::getJsonResponse($json, $response);
35
+	$json = json_encode(Player::all());
36
+	return Responder::getJsonResponse($json, $response);
37 37
 });
38 38
 
39 39
 
40 40
 $api->get('/players/{id}', function ($request, $response, $args) {
41
-    return Responder::getJsonResponse(
42
-        Player::findOrFail($args['id']),
43
-        $response
44
-    );
41
+	return Responder::getJsonResponse(
42
+		Player::findOrFail($args['id']),
43
+		$response
44
+	);
45 45
 });
46 46
 
47 47
 $api->get('/coaches', function ($request, $response, $args) {
48
-    return Responder::getJsonResponse(
49
-        Coach::all(),
50
-        $response
51
-    );
48
+	return Responder::getJsonResponse(
49
+		Coach::all(),
50
+		$response
51
+	);
52 52
 });
53 53
 
54 54
 $api->get('/teams', function ($request, $response, $args) {
55
-    return Responder::getJsonResponse(
56
-        Team::all(),
57
-        $response
58
-    );
55
+	return Responder::getJsonResponse(
56
+		Team::all(),
57
+		$response
58
+	);
59 59
 });
60 60
 
61 61
 $api->get('/teams/{id}', function ($request, $response, $args) {
62
-    return Responder::getJsonResponse(
63
-        Team::complete()
64
-            ->where(
65
-                [
66
-                    'id' => $args['id']
67
-                ]
68
-            )->get(),
69
-        $response
70
-    );
62
+	return Responder::getJsonResponse(
63
+		Team::complete()
64
+			->where(
65
+				[
66
+					'id' => $args['id']
67
+				]
68
+			)->get(),
69
+		$response
70
+	);
71 71
 });
72 72
 
73 73
 $api->get('/teams/{id}/players', function ($request, $response, $args) {
74
-    return Responder::getJsonResponse(
75
-        Team::with(
76
-            'roster'
77
-        )->where(
78
-            [
79
-                'id' => $args['id']
80
-            ]
81
-        )->get(),
82
-        $response
83
-    );
74
+	return Responder::getJsonResponse(
75
+		Team::with(
76
+			'roster'
77
+		)->where(
78
+			[
79
+				'id' => $args['id']
80
+			]
81
+		)->get(),
82
+		$response
83
+	);
84 84
 });
85 85
 
86 86
 $api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) {
87
-    return Responder::getJsonResponse(
88
-        Player::statistics()->where(
89
-            [
90
-                'id' => $args['playerId'],
91
-                'team_id' => $args['id']
92
-            ]
93
-        )->get(),
94
-        $response
95
-    );
87
+	return Responder::getJsonResponse(
88
+		Player::statistics()->where(
89
+			[
90
+				'id' => $args['playerId'],
91
+				'team_id' => $args['id']
92
+			]
93
+		)->get(),
94
+		$response
95
+	);
96 96
 });
97 97
 
98 98
 $api->get('/teams/{id}/coach', function ($request, $response, $args) {
99
-    return Responder::getJsonResponse(
100
-        Team::with(
101
-            'coach'
102
-        )->where(
103
-            [
104
-                'id' => $args['id']
105
-            ]
106
-        )->get(),
107
-        $response
108
-    );
99
+	return Responder::getJsonResponse(
100
+		Team::with(
101
+			'coach'
102
+		)->where(
103
+			[
104
+				'id' => $args['id']
105
+			]
106
+		)->get(),
107
+		$response
108
+	);
109 109
 });
110 110
 
111 111
 $api->get('/leagues', function ($request, $response, $args) {
112
-    return Responder::getJsonResponse(
113
-        League::all(),
114
-        $response
115
-    );
112
+	return Responder::getJsonResponse(
113
+		League::all(),
114
+		$response
115
+	);
116 116
 });
117 117
 
118 118
 $api->get('/leagues/{id}', function ($request, $response, $args) {
119
-    return Responder::getJsonResponse(
120
-        League::with('rounds')
121
-            ->where(
122
-                [
123
-                    'id' => $args['id']
124
-                ]
125
-            )->first(),
126
-        $response
127
-    );
119
+	return Responder::getJsonResponse(
120
+		League::with('rounds')
121
+			->where(
122
+				[
123
+					'id' => $args['id']
124
+				]
125
+			)->first(),
126
+		$response
127
+	);
128 128
 });
129 129
 
130 130
 $api->get('/leagues/{id}/rounds/{roundId}/matches', function ($request, $response, $args) {
131
-    return Responder::getJsonResponse(
132
-        Match::teams()
133
-            ->where(
134
-                [
135
-                    'league_round_id' => $args['roundId'],
136
-                ]
137
-            )->get(),
138
-        $response
139
-    );
131
+	return Responder::getJsonResponse(
132
+		Match::teams()
133
+			->where(
134
+				[
135
+					'league_round_id' => $args['roundId'],
136
+				]
137
+			)->get(),
138
+		$response
139
+	);
140 140
 });
141 141
 
142 142
 $api->put('/leagues/{id}/rounds/{roundId}/simulate', function ($request, $response, $args) {
143
-    return Responder::getJsonResponse(
144
-        MatchSimulator::simulateRound(
145
-            $args['roundId']
146
-        ),
147
-        $response
148
-    );
143
+	return Responder::getJsonResponse(
144
+		MatchSimulator::simulateRound(
145
+			$args['roundId']
146
+		),
147
+		$response
148
+	);
149 149
 });
150 150
 
151 151
 $api->get('/matches', function ($request, $response, $args) {
152
-    return Responder::getJsonResponse(
153
-        Match::teams()->get(),
154
-        $response
155
-    );
152
+	return Responder::getJsonResponse(
153
+		Match::teams()->get(),
154
+		$response
155
+	);
156 156
 });
157 157
 
158 158
 $api->post('/matches', function ($request, $response, $args) {
159
-    $json = $request->getBody();
160
-    $json = json_decode($json, true);
161
-    return Responder::getJsonResponse(
162
-        Match::create(
163
-            $json
164
-        ),
165
-        $response
166
-    );
159
+	$json = $request->getBody();
160
+	$json = json_decode($json, true);
161
+	return Responder::getJsonResponse(
162
+		Match::create(
163
+			$json
164
+		),
165
+		$response
166
+	);
167 167
 });
168 168
 
169 169
 $api->get('/matches/{id}', function ($request, $response, $args) {
170
-    return Responder::getJsonResponse(
171
-        Match::complete()
172
-            ->where(
173
-                [
174
-                    'id' => $args['id']
175
-                ]
176
-            )->first(),
177
-        $response
178
-    );
170
+	return Responder::getJsonResponse(
171
+		Match::complete()
172
+			->where(
173
+				[
174
+					'id' => $args['id']
175
+				]
176
+			)->first(),
177
+		$response
178
+	);
179 179
 });
180 180
 
181 181
 $api->get('/matches/{id}/result', function ($request, $response, $args) {
182
-    $result = MatchResult::complete()
183
-        ->where(
184
-            [
185
-                'id' => $args['id']
186
-            ]
187
-        )->first();
182
+	$result = MatchResult::complete()
183
+		->where(
184
+			[
185
+				'id' => $args['id']
186
+			]
187
+		)->first();
188 188
 
189
-    return Responder::getJsonResponse(
190
-        $result,
191
-        $response
192
-    );
189
+	return Responder::getJsonResponse(
190
+		$result,
191
+		$response
192
+	);
193 193
 });
194 194
 
195 195
 $api->put('/matches/{id}/simulate', function ($request, $response, $args) {
196
-    return Responder::getJsonResponse(
197
-        MatchSimulator::simulateCompleteResult(
198
-            $args['id']
199
-        ),
200
-        $response
201
-    );
196
+	return Responder::getJsonResponse(
197
+		MatchSimulator::simulateCompleteResult(
198
+			$args['id']
199
+		),
200
+		$response
201
+	);
202 202
 });
203 203
 $api->run();
204 204
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     );
128 128
 });
129 129
 
130
-$api->get('/leagues/{id}/rounds/{roundId}/matches', function ($request, $response, $args) {
130
+$api->get('/leagues/{id}/rounds/{roundId}/matches', function($request, $response, $args) {
131 131
     return Responder::getJsonResponse(
132 132
         Match::teams()
133 133
             ->where(
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     );
140 140
 });
141 141
 
142
-$api->put('/leagues/{id}/rounds/{roundId}/simulate', function ($request, $response, $args) {
142
+$api->put('/leagues/{id}/rounds/{roundId}/simulate', function($request, $response, $args) {
143 143
     return Responder::getJsonResponse(
144 144
         MatchSimulator::simulateRound(
145 145
             $args['roundId']
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
     );
149 149
 });
150 150
 
151
-$api->get('/matches', function ($request, $response, $args) {
151
+$api->get('/matches', function($request, $response, $args) {
152 152
     return Responder::getJsonResponse(
153 153
         Match::teams()->get(),
154 154
         $response
155 155
     );
156 156
 });
157 157
 
158
-$api->post('/matches', function ($request, $response, $args) {
158
+$api->post('/matches', function($request, $response, $args) {
159 159
     $json = $request->getBody();
160 160
     $json = json_decode($json, true);
161 161
     return Responder::getJsonResponse(
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     );
167 167
 });
168 168
 
169
-$api->get('/matches/{id}', function ($request, $response, $args) {
169
+$api->get('/matches/{id}', function($request, $response, $args) {
170 170
     return Responder::getJsonResponse(
171 171
         Match::complete()
172 172
             ->where(
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     );
179 179
 });
180 180
 
181
-$api->get('/matches/{id}/result', function ($request, $response, $args) {
181
+$api->get('/matches/{id}/result', function($request, $response, $args) {
182 182
     $result = MatchResult::complete()
183 183
         ->where(
184 184
             [
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     );
193 193
 });
194 194
 
195
-$api->put('/matches/{id}/simulate', function ($request, $response, $args) {
195
+$api->put('/matches/{id}/simulate', function($request, $response, $args) {
196 196
     return Responder::getJsonResponse(
197 197
         MatchSimulator::simulateCompleteResult(
198 198
             $args['id']
Please login to merge, or discard this patch.
api/database/seeds/A001LeaguesSeeder.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -9,46 +9,46 @@
 block discarded – undo
9 9
 
10 10
 class A001LeaguesSeeder
11 11
 {
12
-    function run()
13
-    {
14
-        $leagues = [
15
-            'friendly' => 16,
16
-            'europa league' => 8
17
-        ];
18
-        $teams = Team::all()->toArray();
19
-        foreach ($leagues as $league => $teamsNum) {
12
+	function run()
13
+	{
14
+		$leagues = [
15
+			'friendly' => 16,
16
+			'europa league' => 8
17
+		];
18
+		$teams = Team::all()->toArray();
19
+		foreach ($leagues as $league => $teamsNum) {
20 20
 
21
-            $teamCopy = $teams;
22
-            $league = League::create(
23
-                [
24
-                    'name' => $league,
25
-                    'teams' => $teamsNum
26
-                ]
27
-            );
21
+			$teamCopy = $teams;
22
+			$league = League::create(
23
+				[
24
+					'name' => $league,
25
+					'teams' => $teamsNum
26
+				]
27
+			);
28 28
 
29
-            //Create Rounds
30
-            shuffle($teamCopy);
31
-            $teamCopy = array_splice($teamCopy, 0, $teamsNum);
32
-            $rounds = LeagueFixtureGenerator::generate($teamCopy);
33
-            foreach ($rounds as $i => $round) {
29
+			//Create Rounds
30
+			shuffle($teamCopy);
31
+			$teamCopy = array_splice($teamCopy, 0, $teamsNum);
32
+			$rounds = LeagueFixtureGenerator::generate($teamCopy);
33
+			foreach ($rounds as $i => $round) {
34 34
 
35
-                $leagueRound = LeagueRound::create(
36
-                    [
37
-                        'league_id' => $league->id,
38
-                        'day' => $i + 1
39
-                    ]
40
-                );
35
+				$leagueRound = LeagueRound::create(
36
+					[
37
+						'league_id' => $league->id,
38
+						'day' => $i + 1
39
+					]
40
+				);
41 41
 
42
-                foreach ($round as $match) {
43
-                    $newMatch = Match::create(
44
-                        [
45
-                            'home_team_id' => $match['home_team_id'],
46
-                            'away_team_id' => $match['away_team_id'],
47
-                            'league_round_id' => $leagueRound->id
48
-                        ]
49
-                    );
50
-                }
51
-            }
52
-        }
53
-    }
42
+				foreach ($round as $match) {
43
+					$newMatch = Match::create(
44
+						[
45
+							'home_team_id' => $match['home_team_id'],
46
+							'away_team_id' => $match['away_team_id'],
47
+							'league_round_id' => $leagueRound->id
48
+						]
49
+					);
50
+				}
51
+			}
52
+		}
53
+	}
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
api/database/migrations/CreateLeagueRoundsTable.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,19 +5,19 @@
 block discarded – undo
5 5
 
6 6
 class CreateLeagueRoundsTable
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function run()
14
-    {
15
-        Capsule::schema()->dropIfExists('league_rounds');
16
-        Capsule::schema()->create('league_rounds', function (Blueprint $table) {
17
-            $table->increments('id');
18
-            $table->integer('league_id');
19
-            $table->integer('day')->default(0);
20
-            $table->timestamps();
21
-        });
22
-    }
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function run()
14
+	{
15
+		Capsule::schema()->dropIfExists('league_rounds');
16
+		Capsule::schema()->create('league_rounds', function (Blueprint $table) {
17
+			$table->increments('id');
18
+			$table->integer('league_id');
19
+			$table->integer('day')->default(0);
20
+			$table->timestamps();
21
+		});
22
+	}
23 23
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
api/Lib/DsManager/Models/Orm/League.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,24 +8,24 @@
 block discarded – undo
8 8
  */
9 9
 class League extends DsManagerOrm
10 10
 {
11
-    /**
12
-     * @var string
13
-     */
14
-    protected $table = 'leagues';
11
+	/**
12
+	 * @var string
13
+	 */
14
+	protected $table = 'leagues';
15 15
 
16
-    /**
17
-     * @var array
18
-     */
19
-    protected $fillable = [
20
-        'name',
21
-        'teams'
22
-    ];
16
+	/**
17
+	 * @var array
18
+	 */
19
+	protected $fillable = [
20
+		'name',
21
+		'teams'
22
+	];
23 23
 
24
-    /**
25
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany
26
-     */
27
-    public function rounds()
28
-    {
29
-        return $this->hasMany(LeagueRound::class);
30
-    }
24
+	/**
25
+	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
26
+	 */
27
+	public function rounds()
28
+	{
29
+		return $this->hasMany(LeagueRound::class);
30
+	}
31 31
 } 
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
api/Lib/DsManager/Models/Orm/LeagueRound.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,32 +9,32 @@
 block discarded – undo
9 9
 class LeagueRound extends DsManagerOrm
10 10
 {
11 11
 
12
-    /**
13
-     * @var string
14
-     */
15
-    protected $table = 'league_rounds';
12
+	/**
13
+	 * @var string
14
+	 */
15
+	protected $table = 'league_rounds';
16 16
 
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $fillable = [
21
-        'league_id',
22
-        'day'
23
-    ];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $fillable = [
21
+		'league_id',
22
+		'day'
23
+	];
24 24
 
25
-    /**
26
-     * @return \Illuminate\Database\Eloquent\Relations\HasOne
27
-     */
28
-    public function league()
29
-    {
30
-        return $this->hasOne(League::class);
31
-    }
25
+	/**
26
+	 * @return \Illuminate\Database\Eloquent\Relations\HasOne
27
+	 */
28
+	public function league()
29
+	{
30
+		return $this->hasOne(League::class);
31
+	}
32 32
 
33
-    /**
34
-     * @return \Illuminate\Database\Eloquent\Relations\HasMany
35
-     */
36
-    public function matches()
37
-    {
38
-        return $this->hasMany(Match::class);
39
-    }
33
+	/**
34
+	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
35
+	 */
36
+	public function matches()
37
+	{
38
+		return $this->hasMany(Match::class);
39
+	}
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
api/Lib/DsManager/Models/Orm/Match.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -9,72 +9,72 @@
 block discarded – undo
9 9
 class Match extends DsManagerOrm
10 10
 {
11 11
 
12
-    /**
13
-     * @var string
14
-     */
15
-    protected $table = 'matches';
12
+	/**
13
+	 * @var string
14
+	 */
15
+	protected $table = 'matches';
16 16
 
17
-    /**
18
-     * @var array
19
-     */
20
-    protected $fillable = [
21
-        'home_team_id',
22
-        'away_team_id',
23
-        'league_round_id'
24
-    ];
17
+	/**
18
+	 * @var array
19
+	 */
20
+	protected $fillable = [
21
+		'home_team_id',
22
+		'away_team_id',
23
+		'league_round_id'
24
+	];
25 25
 
26
-    /**
27
-     * @var array
28
-     */
29
-    protected $hidden = [
30
-        'home_team_id',
31
-        'away_team_id',
32
-        'created_at',
33
-        'updated_at',
34
-        'info'
35
-    ];
26
+	/**
27
+	 * @var array
28
+	 */
29
+	protected $hidden = [
30
+		'home_team_id',
31
+		'away_team_id',
32
+		'created_at',
33
+		'updated_at',
34
+		'info'
35
+	];
36 36
 
37
-    /**
38
-     * @var array
39
-     */
40
-    protected $casts = [
41
-        'simulated' => 'boolean'
42
-    ];
37
+	/**
38
+	 * @var array
39
+	 */
40
+	protected $casts = [
41
+		'simulated' => 'boolean'
42
+	];
43 43
 
44
-    /**
45
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
46
-     */
47
-    public function homeTeam()
48
-    {
49
-        return $this->belongsTo(Team::class, 'home_team_id');
50
-    }
44
+	/**
45
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
46
+	 */
47
+	public function homeTeam()
48
+	{
49
+		return $this->belongsTo(Team::class, 'home_team_id');
50
+	}
51 51
 
52
-    /**
53
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
54
-     */
55
-    public function awayTeam()
56
-    {
57
-        return $this->belongsTo(Team::class, 'away_team_id');
58
-    }
52
+	/**
53
+	 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
54
+	 */
55
+	public function awayTeam()
56
+	{
57
+		return $this->belongsTo(Team::class, 'away_team_id');
58
+	}
59 59
 
60
-    public function scopeTeams($query)
61
-    {
62
-        return $query->with(
63
-            'homeTeam',
64
-            'awayTeam'
65
-        );
66
-    }
60
+	public function scopeTeams($query)
61
+	{
62
+		return $query->with(
63
+			'homeTeam',
64
+			'awayTeam'
65
+		);
66
+	}
67 67
 
68
-    public function scopeComplete($query)
69
-    {
70
-        return $query->with(
71
-            'homeTeam',
72
-            'homeTeam.roster',
73
-            'homeTeam.coach',
74
-            'awayTeam',
75
-            'awayTeam.roster',
76
-            'awayTeam.coach'
77
-        );
78
-    }
68
+	public function scopeComplete($query)
69
+	{
70
+		return $query->with(
71
+			'homeTeam',
72
+			'homeTeam.roster',
73
+			'homeTeam.coach',
74
+			'awayTeam',
75
+			'awayTeam.roster',
76
+			'awayTeam.coach'
77
+		);
78
+	}
79 79
 
80 80
 }
81 81
\ No newline at end of file
Please login to merge, or discard this patch.