Completed
Push — master ( d49014...393727 )
by Vincenzo
02:54
created
api/index.php 2 patches
Spacing   +14 added lines, -14 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",
@@ -28,34 +28,34 @@  discard block
 block discarded – undo
28 28
     return Responder::getJsonResponse($jsonResp, $response);
29 29
 });
30 30
 
31
-$api->get('/players', function ($request, $response, $args) {
31
+$api->get('/players', function($request, $response, $args) {
32 32
     $json = json_encode(Player::all());
33 33
     return Responder::getJsonResponse($json, $response);
34 34
 });
35 35
 
36 36
 
37
-$api->get('/players/{id}', function ($request, $response, $args) {
37
+$api->get('/players/{id}', function($request, $response, $args) {
38 38
     return Responder::getJsonResponse(
39 39
         Player::findOrFail($args['id']),
40 40
         $response
41 41
     );
42 42
 });
43 43
 
44
-$api->get('/coaches', function ($request, $response, $args) {
44
+$api->get('/coaches', function($request, $response, $args) {
45 45
     return Responder::getJsonResponse(
46 46
         Coach::all(),
47 47
         $response
48 48
     );
49 49
 });
50 50
 
51
-$api->get('/teams', function ($request, $response, $args) {
51
+$api->get('/teams', function($request, $response, $args) {
52 52
     return Responder::getJsonResponse(
53 53
         Team::all(),
54 54
         $response
55 55
     );
56 56
 });
57 57
 
58
-$api->get('/teams/{id}', function ($request, $response, $args) {
58
+$api->get('/teams/{id}', function($request, $response, $args) {
59 59
     return Responder::getJsonResponse(
60 60
         Team::with(
61 61
             'roster',
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     );
70 70
 });
71 71
 
72
-$api->get('/teams/{id}/players', function ($request, $response, $args) {
72
+$api->get('/teams/{id}/players', function($request, $response, $args) {
73 73
     return Responder::getJsonResponse(
74 74
         Team::with(
75 75
             'roster'
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     );
83 83
 });
84 84
 
85
-$api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) {
85
+$api->get('/teams/{id}/players/{playerId}', function($request, $response, $args) {
86 86
     return Responder::getJsonResponse(
87 87
         Player::where(
88 88
             [
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     );
95 95
 });
96 96
 
97
-$api->get('/teams/{id}/coach', function ($request, $response, $args) {
97
+$api->get('/teams/{id}/coach', function($request, $response, $args) {
98 98
     return Responder::getJsonResponse(
99 99
         Team::with(
100 100
             'coach'
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     );
108 108
 });
109 109
 
110
-$api->get('/matches', function ($request, $response, $args) {
110
+$api->get('/matches', function($request, $response, $args) {
111 111
     return Responder::getJsonResponse(
112 112
         \App\Lib\DsManager\Models\Orm\Match::with(
113 113
             'homeTeam',
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     );
118 118
 });
119 119
 
120
-$api->post('/matches', function ($request, $response, $args) {
120
+$api->post('/matches', function($request, $response, $args) {
121 121
     $json = $request->getBody();
122 122
     $json = json_decode($json, true);
123 123
     return Responder::getJsonResponse(
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     );
129 129
 });
130 130
 
131
-$api->get('/matches/{id}', function ($request, $response, $args) {
131
+$api->get('/matches/{id}', function($request, $response, $args) {
132 132
     return Responder::getJsonResponse(
133 133
         \App\Lib\DsManager\Models\Orm\Match::with(
134 134
             'homeTeam',
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     );
147 147
 });
148 148
 
149
-$api->get('/matches/{id}/result', function ($request, $response, $args) {
149
+$api->get('/matches/{id}/result', function($request, $response, $args) {
150 150
     $result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
151 151
         ->where(
152 152
             [
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     );
161 161
 });
162 162
 
163
-$api->put('/matches/{id}/simulate', function ($request, $response, $args) {
163
+$api->put('/matches/{id}/simulate', function($request, $response, $args) {
164 164
     $result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
165 165
         ->where(
166 166
             [
Please login to merge, or discard this patch.
Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -10,189 +10,189 @@
 block discarded – undo
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
-        ]
26
-    );
27
-    return Responder::getJsonResponse($jsonResp, $response);
21
+	$jsonResp = json_encode(
22
+		[
23
+			"status" => "service up",
24
+			"message" => "in a bottle"
25
+		]
26
+	);
27
+	return Responder::getJsonResponse($jsonResp, $response);
28 28
 });
29 29
 
30 30
 $api->get('/players', function ($request, $response, $args) {
31
-    $json = json_encode(Player::all());
32
-    return Responder::getJsonResponse($json, $response);
31
+	$json = json_encode(Player::all());
32
+	return Responder::getJsonResponse($json, $response);
33 33
 });
34 34
 
35 35
 
36 36
 $api->get('/players/{id}', function ($request, $response, $args) {
37
-    return Responder::getJsonResponse(
38
-        Player::findOrFail($args['id']),
39
-        $response
40
-    );
37
+	return Responder::getJsonResponse(
38
+		Player::findOrFail($args['id']),
39
+		$response
40
+	);
41 41
 });
42 42
 
43 43
 $api->get('/coaches', function ($request, $response, $args) {
44
-    return Responder::getJsonResponse(
45
-        Coach::all(),
46
-        $response
47
-    );
44
+	return Responder::getJsonResponse(
45
+		Coach::all(),
46
+		$response
47
+	);
48 48
 });
49 49
 
50 50
 $api->get('/teams', function ($request, $response, $args) {
51
-    return Responder::getJsonResponse(
52
-        Team::all(),
53
-        $response
54
-    );
51
+	return Responder::getJsonResponse(
52
+		Team::all(),
53
+		$response
54
+	);
55 55
 });
56 56
 
57 57
 $api->get('/teams/{id}', function ($request, $response, $args) {
58
-    return Responder::getJsonResponse(
59
-        Team::complete()
60
-            ->where(
61
-                [
62
-                    'id' => $args['id']
63
-                ]
64
-            )->get(),
65
-        $response
66
-    );
58
+	return Responder::getJsonResponse(
59
+		Team::complete()
60
+			->where(
61
+				[
62
+					'id' => $args['id']
63
+				]
64
+			)->get(),
65
+		$response
66
+	);
67 67
 });
68 68
 
69 69
 $api->get('/teams/{id}/players', function ($request, $response, $args) {
70
-    return Responder::getJsonResponse(
71
-        Team::with(
72
-            'roster'
73
-        )->where(
74
-            [
75
-                'id' => $args['id']
76
-            ]
77
-        )->get(),
78
-        $response
79
-    );
70
+	return Responder::getJsonResponse(
71
+		Team::with(
72
+			'roster'
73
+		)->where(
74
+			[
75
+				'id' => $args['id']
76
+			]
77
+		)->get(),
78
+		$response
79
+	);
80 80
 });
81 81
 
82 82
 $api->get('/teams/{id}/players/{playerId}', function ($request, $response, $args) {
83
-    return Responder::getJsonResponse(
84
-        Player::statistics()->where(
85
-            [
86
-                'id' => $args['playerId'],
87
-                'team_id' => $args['id']
88
-            ]
89
-        )->get(),
90
-        $response
91
-    );
83
+	return Responder::getJsonResponse(
84
+		Player::statistics()->where(
85
+			[
86
+				'id' => $args['playerId'],
87
+				'team_id' => $args['id']
88
+			]
89
+		)->get(),
90
+		$response
91
+	);
92 92
 });
93 93
 
94 94
 $api->get('/teams/{id}/coach', function ($request, $response, $args) {
95
-    return Responder::getJsonResponse(
96
-        Team::with(
97
-            'coach'
98
-        )->where(
99
-            [
100
-                'id' => $args['id']
101
-            ]
102
-        )->get(),
103
-        $response
104
-    );
95
+	return Responder::getJsonResponse(
96
+		Team::with(
97
+			'coach'
98
+		)->where(
99
+			[
100
+				'id' => $args['id']
101
+			]
102
+		)->get(),
103
+		$response
104
+	);
105 105
 });
106 106
 
107 107
 $api->get('/matches', function ($request, $response, $args) {
108
-    return Responder::getJsonResponse(
109
-        \App\Lib\DsManager\Models\Orm\Match::with(
110
-            'homeTeam',
111
-            'awayTeam'
112
-        )->get(),
113
-        $response
114
-    );
108
+	return Responder::getJsonResponse(
109
+		\App\Lib\DsManager\Models\Orm\Match::with(
110
+			'homeTeam',
111
+			'awayTeam'
112
+		)->get(),
113
+		$response
114
+	);
115 115
 });
116 116
 
117 117
 $api->post('/matches', function ($request, $response, $args) {
118
-    $json = $request->getBody();
119
-    $json = json_decode($json, true);
120
-    return Responder::getJsonResponse(
121
-        \App\Lib\DsManager\Models\Orm\Match::create(
122
-            $json
123
-        ),
124
-        $response
125
-    );
118
+	$json = $request->getBody();
119
+	$json = json_decode($json, true);
120
+	return Responder::getJsonResponse(
121
+		\App\Lib\DsManager\Models\Orm\Match::create(
122
+			$json
123
+		),
124
+		$response
125
+	);
126 126
 });
127 127
 
128 128
 $api->get('/matches/{id}', function ($request, $response, $args) {
129
-    return Responder::getJsonResponse(
130
-        \App\Lib\DsManager\Models\Orm\Match::complete()
131
-            ->where(
132
-                [
133
-                    'id' => $args['id']
134
-                ]
135
-            )->first(),
136
-        $response
137
-    );
129
+	return Responder::getJsonResponse(
130
+		\App\Lib\DsManager\Models\Orm\Match::complete()
131
+			->where(
132
+				[
133
+					'id' => $args['id']
134
+				]
135
+			)->first(),
136
+		$response
137
+	);
138 138
 });
139 139
 
140 140
 $api->get('/matches/{id}/result', function ($request, $response, $args) {
141
-    $result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
142
-        ->where(
143
-            [
144
-                'id' => $args['id']
145
-            ]
146
-        )->first();
147
-
148
-    return Responder::getJsonResponse(
149
-        $result,
150
-        $response
151
-    );
141
+	$result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
142
+		->where(
143
+			[
144
+				'id' => $args['id']
145
+			]
146
+		)->first();
147
+
148
+	return Responder::getJsonResponse(
149
+		$result,
150
+		$response
151
+	);
152 152
 });
153 153
 
154 154
 $api->put('/matches/{id}/simulate', function ($request, $response, $args) {
155
-    $result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
156
-        ->where(
157
-            [
158
-                'id' => $args['id']
159
-            ]
160
-        )->first();
161
-
162
-    if (!empty($result) && !$result->simulated) {
163
-        //simulate match
164
-        $match = \App\Lib\DsManager\Models\Match::fromArray(
165
-            \App\Lib\DsManager\Models\Orm\Match::complete()
166
-                ->where(
167
-                    [
168
-                        'id' => $args['id']
169
-                    ]
170
-                )->first()->toArray()
171
-        );
172
-        $matchResult = $match->simulate()->toArray();
173
-        $result = \App\Lib\DsManager\Models\Orm\MatchResult::where(
174
-            [
175
-                'id' => $args['id']
176
-            ]
177
-        )->update(
178
-            \App\Lib\DsManager\Models\Orm\MatchResult::resolveAttributes(
179
-                $matchResult,
180
-                $args['id']
181
-            )
182
-        );
183
-        if ($result === 1) {
184
-            $result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
185
-                ->where(
186
-                    [
187
-                        'id' => $args['id']
188
-                    ]
189
-                )->first();
190
-        }
191
-
192
-    }
193
-    return Responder::getJsonResponse(
194
-        $result,
195
-        $response
196
-    );
155
+	$result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
156
+		->where(
157
+			[
158
+				'id' => $args['id']
159
+			]
160
+		)->first();
161
+
162
+	if (!empty($result) && !$result->simulated) {
163
+		//simulate match
164
+		$match = \App\Lib\DsManager\Models\Match::fromArray(
165
+			\App\Lib\DsManager\Models\Orm\Match::complete()
166
+				->where(
167
+					[
168
+						'id' => $args['id']
169
+					]
170
+				)->first()->toArray()
171
+		);
172
+		$matchResult = $match->simulate()->toArray();
173
+		$result = \App\Lib\DsManager\Models\Orm\MatchResult::where(
174
+			[
175
+				'id' => $args['id']
176
+			]
177
+		)->update(
178
+			\App\Lib\DsManager\Models\Orm\MatchResult::resolveAttributes(
179
+				$matchResult,
180
+				$args['id']
181
+			)
182
+		);
183
+		if ($result === 1) {
184
+			$result = \App\Lib\DsManager\Models\Orm\MatchResult::complete()
185
+				->where(
186
+					[
187
+						'id' => $args['id']
188
+					]
189
+				)->first();
190
+		}
191
+
192
+	}
193
+	return Responder::getJsonResponse(
194
+		$result,
195
+		$response
196
+	);
197 197
 });
198 198
 $api->run();
199 199
\ No newline at end of file
Please login to merge, or discard this patch.
api/Lib/DsManager/Helpers/Randomizer.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@
 block discarded – undo
10 10
  */
11 11
 class Randomizer
12 12
 {
13
-    /**
14
-     * @param $percentage
15
-     * @return bool
16
-     */
17
-    public static function boolOnPercentage($percentage)
18
-    {
19
-        return (rand(0, 100) < $percentage);
20
-    }
13
+	/**
14
+	 * @param $percentage
15
+	 * @return bool
16
+	 */
17
+	public static function boolOnPercentage($percentage)
18
+	{
19
+		return (rand(0, 100) < $percentage);
20
+	}
21 21
 
22
-    /**
23
-     * @param $skill
24
-     * @return int
25
-     */
26
-    public static function voteFromSkill($skill)
27
-    {
28
-        return rand((2 * ($skill - 100) / 25), 10);
29
-    }
22
+	/**
23
+	 * @param $skill
24
+	 * @return int
25
+	 */
26
+	public static function voteFromSkill($skill)
27
+	{
28
+		return rand((2 * ($skill - 100) / 25), 10);
29
+	}
30 30
 
31 31
 }
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
api/Lib/DsManager/Models/Orm/MatchResult.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -9,118 +9,118 @@
 block discarded – undo
9 9
  */
10 10
 class MatchResult extends Match
11 11
 {
12
-    /**
13
-     * @var array
14
-     */
15
-    protected $fillable = [
16
-        'goal_home',
17
-        'goal_away',
18
-        'info',
19
-        'simulated'
20
-    ];
12
+	/**
13
+	 * @var array
14
+	 */
15
+	protected $fillable = [
16
+		'goal_home',
17
+		'goal_away',
18
+		'info',
19
+		'simulated'
20
+	];
21 21
 
22
-    protected $hidden = [
23
-        'home_team_id',
24
-        'away_team_id',
25
-        'created_at',
26
-        'updated_at'
27
-    ];
22
+	protected $hidden = [
23
+		'home_team_id',
24
+		'away_team_id',
25
+		'created_at',
26
+		'updated_at'
27
+	];
28 28
 
29
-    /**
30
-     * @var array
31
-     */
32
-    protected $casts = [
33
-        'info' => 'json',
34
-        'simulated' => 'boolean'
35
-    ];
29
+	/**
30
+	 * @var array
31
+	 */
32
+	protected $casts = [
33
+		'info' => 'json',
34
+		'simulated' => 'boolean'
35
+	];
36 36
 
37
-    public static function resolveAttributes(array $attributes, $matchId)
38
-    {
39
-        self::generateAppearances(
40
-            [
41
-                $attributes['home_team_id'],
42
-                $attributes['away_team_id']
43
-            ],
44
-            $matchId
45
-        );
46
-        if (array_key_exists('info', $attributes)) {
47
-            if (array_key_exists('scorers', $attributes['info'])) {
48
-                foreach ($attributes['info']['scorers']['home'] as $scorerHome) {
49
-                    self::addScorer($matchId, $attributes['home_team_id'], $scorerHome->id);
50
-                }
51
-                foreach ($attributes['info']['scorers']['away'] as $scorerAway) {
52
-                    self::addScorer($matchId, $attributes['away_team_id'], $scorerAway->id);
53
-                }
54
-                unset($attributes['info']['scorers']);
55
-            }
56
-            $attributes['info'] = json_encode($attributes['info']);
57
-        }
58
-        return $attributes;
59
-    }
37
+	public static function resolveAttributes(array $attributes, $matchId)
38
+	{
39
+		self::generateAppearances(
40
+			[
41
+				$attributes['home_team_id'],
42
+				$attributes['away_team_id']
43
+			],
44
+			$matchId
45
+		);
46
+		if (array_key_exists('info', $attributes)) {
47
+			if (array_key_exists('scorers', $attributes['info'])) {
48
+				foreach ($attributes['info']['scorers']['home'] as $scorerHome) {
49
+					self::addScorer($matchId, $attributes['home_team_id'], $scorerHome->id);
50
+				}
51
+				foreach ($attributes['info']['scorers']['away'] as $scorerAway) {
52
+					self::addScorer($matchId, $attributes['away_team_id'], $scorerAway->id);
53
+				}
54
+				unset($attributes['info']['scorers']);
55
+			}
56
+			$attributes['info'] = json_encode($attributes['info']);
57
+		}
58
+		return $attributes;
59
+	}
60 60
 
61
-    private static function addScorer($matchId, $teamId, $playerId)
62
-    {
63
-        $scorer = MatchPlayer::where(
64
-            [
65
-                'match_id' => $matchId,
66
-                'team_id' => $teamId,
67
-                'player_id' => $playerId
68
-            ]
69
-        )->first();
70
-        if (!empty($scorer)) {
71
-            $scorer->goals = $scorer->goals + 1;
72
-            $scorer->vote = $scorer->vote <= 9 ? $scorer->vote + rand(0, 1) : $scorer->vote;
73
-            $scorer->save();
74
-        } else {
75
-            MatchPlayer::create(
76
-                [
77
-                    'match_id' => $matchId,
78
-                    'team_id' => $teamId,
79
-                    'player_id' => $playerId,
80
-                    'goals' => 1
81
-                ]
82
-            );
83
-        }
84
-    }
61
+	private static function addScorer($matchId, $teamId, $playerId)
62
+	{
63
+		$scorer = MatchPlayer::where(
64
+			[
65
+				'match_id' => $matchId,
66
+				'team_id' => $teamId,
67
+				'player_id' => $playerId
68
+			]
69
+		)->first();
70
+		if (!empty($scorer)) {
71
+			$scorer->goals = $scorer->goals + 1;
72
+			$scorer->vote = $scorer->vote <= 9 ? $scorer->vote + rand(0, 1) : $scorer->vote;
73
+			$scorer->save();
74
+		} else {
75
+			MatchPlayer::create(
76
+				[
77
+					'match_id' => $matchId,
78
+					'team_id' => $teamId,
79
+					'player_id' => $playerId,
80
+					'goals' => 1
81
+				]
82
+			);
83
+		}
84
+	}
85 85
 
86
-    private static function generateAppearances(
87
-        $teamIds,
88
-        $matchId
89
-    )
90
-    {
91
-        foreach ($teamIds as $id) {
92
-            $players = Player::where('team_id', $id)->get()->random(11);
93
-            foreach ($players as $player) {
94
-                MatchPlayer::create(
95
-                    [
96
-                        'match_id' => $matchId,
97
-                        'team_id' => $id,
98
-                        'player_id' => $player->id,
99
-                        'vote' => Randomizer::voteFromSkill($player->skillAvg)
100
-                    ]
101
-                );
102
-            }
103
-        }
104
-    }
86
+	private static function generateAppearances(
87
+		$teamIds,
88
+		$matchId
89
+	)
90
+	{
91
+		foreach ($teamIds as $id) {
92
+			$players = Player::where('team_id', $id)->get()->random(11);
93
+			foreach ($players as $player) {
94
+				MatchPlayer::create(
95
+					[
96
+						'match_id' => $matchId,
97
+						'team_id' => $id,
98
+						'player_id' => $player->id,
99
+						'vote' => Randomizer::voteFromSkill($player->skillAvg)
100
+					]
101
+				);
102
+			}
103
+		}
104
+	}
105 105
 
106
-    public function scorers()
107
-    {
108
-        return $this->belongsToMany(
109
-            Player::class,
110
-            'match_players',
111
-            'match_id'
112
-        )->withPivot(
113
-            'team_id',
114
-            'goals'
115
-        )->where(
116
-            'goals', '>', 0
117
-        );
118
-    }
106
+	public function scorers()
107
+	{
108
+		return $this->belongsToMany(
109
+			Player::class,
110
+			'match_players',
111
+			'match_id'
112
+		)->withPivot(
113
+			'team_id',
114
+			'goals'
115
+		)->where(
116
+			'goals', '>', 0
117
+		);
118
+	}
119 119
 
120
-    public function scopeComplete($query)
121
-    {
122
-        return parent::scopeComplete($query)->with('scorers');
123
-    }
120
+	public function scopeComplete($query)
121
+	{
122
+		return parent::scopeComplete($query)->with('scorers');
123
+	}
124 124
 
125 125
 
126 126
 }
127 127
\ No newline at end of file
Please login to merge, or discard this patch.
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.