@@ -42,7 +42,6 @@ |
||
42 | 42 | /** |
43 | 43 | * Show the form for editing the specified resource. |
44 | 44 | * |
45 | - * @param int $id |
|
46 | 45 | * @return Response |
47 | 46 | */ |
48 | 47 | public function edit() |
@@ -2,96 +2,96 @@ |
||
2 | 2 | |
3 | 3 | class CoursesController extends \BaseController { |
4 | 4 | |
5 | - public function __construct(Course $course) |
|
6 | - { |
|
7 | - $this->course = $course; |
|
8 | - } |
|
5 | + public function __construct(Course $course) |
|
6 | + { |
|
7 | + $this->course = $course; |
|
8 | + } |
|
9 | 9 | |
10 | - /** |
|
11 | - * Show the form for creating a new resource. |
|
12 | - * |
|
13 | - * @return Response |
|
14 | - */ |
|
15 | - public function index() |
|
16 | - { |
|
17 | - $data = $this->course->all(); |
|
18 | - return $data; |
|
19 | - } |
|
10 | + /** |
|
11 | + * Show the form for creating a new resource. |
|
12 | + * |
|
13 | + * @return Response |
|
14 | + */ |
|
15 | + public function index() |
|
16 | + { |
|
17 | + $data = $this->course->all(); |
|
18 | + return $data; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * Store a newly created resource in storage. |
|
23 | - * |
|
24 | - * @return Response |
|
25 | - */ |
|
26 | - public function store() |
|
27 | - { |
|
28 | - // |
|
29 | - } |
|
21 | + /** |
|
22 | + * Store a newly created resource in storage. |
|
23 | + * |
|
24 | + * @return Response |
|
25 | + */ |
|
26 | + public function store() |
|
27 | + { |
|
28 | + // |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Display the specified resource. |
|
33 | - * |
|
34 | - * @param int $id |
|
35 | - * @return Response |
|
36 | - */ |
|
37 | - public function show($id) |
|
38 | - { |
|
39 | - return Course::find($id)->get(); |
|
40 | - } |
|
31 | + /** |
|
32 | + * Display the specified resource. |
|
33 | + * |
|
34 | + * @param int $id |
|
35 | + * @return Response |
|
36 | + */ |
|
37 | + public function show($id) |
|
38 | + { |
|
39 | + return Course::find($id)->get(); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Show the form for editing the specified resource. |
|
44 | - * |
|
45 | - * @param int $id |
|
46 | - * @return Response |
|
47 | - */ |
|
48 | - public function edit() |
|
49 | - { |
|
42 | + /** |
|
43 | + * Show the form for editing the specified resource. |
|
44 | + * |
|
45 | + * @param int $id |
|
46 | + * @return Response |
|
47 | + */ |
|
48 | + public function edit() |
|
49 | + { |
|
50 | 50 | $operation = Input::get('oper'); |
51 | - switch ($operation) { |
|
52 | - case "add": |
|
53 | - $this->course->name = Input::get('name'); |
|
51 | + switch ($operation) { |
|
52 | + case "add": |
|
53 | + $this->course->name = Input::get('name'); |
|
54 | 54 | $this->course->par = Input::get('par'); |
55 | 55 | $this->course->rating = Input::get('rating'); |
56 | 56 | $this->course->slope = Input::get('slope'); |
57 | - $this->course->save(); |
|
58 | - break; |
|
59 | - case "edit": |
|
60 | - $id = Input::get('id'); |
|
61 | - $this->course = $this->course->find($id); |
|
62 | - $this->course->name = Input::get('name'); |
|
57 | + $this->course->save(); |
|
58 | + break; |
|
59 | + case "edit": |
|
60 | + $id = Input::get('id'); |
|
61 | + $this->course = $this->course->find($id); |
|
62 | + $this->course->name = Input::get('name'); |
|
63 | 63 | $this->course->par = Input::get('par'); |
64 | 64 | $this->course->rating = Input::get('rating'); |
65 | 65 | $this->course->slope = Input::get('slope'); |
66 | - $this->course->save(); |
|
67 | - break; |
|
68 | - case "del": |
|
69 | - $id = Input::get('id'); |
|
70 | - $this->course = $this->course->destroy($id); |
|
71 | - break; |
|
72 | - } |
|
73 | - } |
|
66 | + $this->course->save(); |
|
67 | + break; |
|
68 | + case "del": |
|
69 | + $id = Input::get('id'); |
|
70 | + $this->course = $this->course->destroy($id); |
|
71 | + break; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Update the specified resource in storage. |
|
77 | - * |
|
78 | - * @param int $id |
|
79 | - * @return Response |
|
80 | - */ |
|
81 | - public function update($id) |
|
82 | - { |
|
83 | - // |
|
84 | - } |
|
75 | + /** |
|
76 | + * Update the specified resource in storage. |
|
77 | + * |
|
78 | + * @param int $id |
|
79 | + * @return Response |
|
80 | + */ |
|
81 | + public function update($id) |
|
82 | + { |
|
83 | + // |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * Remove the specified resource from storage. |
|
88 | - * |
|
89 | - * @param int $id |
|
90 | - * @return Response |
|
91 | - */ |
|
92 | - public function destroy($id) |
|
93 | - { |
|
94 | - // |
|
95 | - } |
|
86 | + /** |
|
87 | + * Remove the specified resource from storage. |
|
88 | + * |
|
89 | + * @param int $id |
|
90 | + * @return Response |
|
91 | + */ |
|
92 | + public function destroy($id) |
|
93 | + { |
|
94 | + // |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -49,26 +49,26 @@ |
||
49 | 49 | { |
50 | 50 | $operation = Input::get('oper'); |
51 | 51 | switch ($operation) { |
52 | - case "add": |
|
53 | - $this->course->name = Input::get('name'); |
|
54 | - $this->course->par = Input::get('par'); |
|
55 | - $this->course->rating = Input::get('rating'); |
|
56 | - $this->course->slope = Input::get('slope'); |
|
57 | - $this->course->save(); |
|
58 | - break; |
|
59 | - case "edit": |
|
60 | - $id = Input::get('id'); |
|
61 | - $this->course = $this->course->find($id); |
|
62 | - $this->course->name = Input::get('name'); |
|
63 | - $this->course->par = Input::get('par'); |
|
64 | - $this->course->rating = Input::get('rating'); |
|
65 | - $this->course->slope = Input::get('slope'); |
|
66 | - $this->course->save(); |
|
67 | - break; |
|
68 | - case "del": |
|
69 | - $id = Input::get('id'); |
|
70 | - $this->course = $this->course->destroy($id); |
|
71 | - break; |
|
52 | + case "add": |
|
53 | + $this->course->name = Input::get('name'); |
|
54 | + $this->course->par = Input::get('par'); |
|
55 | + $this->course->rating = Input::get('rating'); |
|
56 | + $this->course->slope = Input::get('slope'); |
|
57 | + $this->course->save(); |
|
58 | + break; |
|
59 | + case "edit": |
|
60 | + $id = Input::get('id'); |
|
61 | + $this->course = $this->course->find($id); |
|
62 | + $this->course->name = Input::get('name'); |
|
63 | + $this->course->par = Input::get('par'); |
|
64 | + $this->course->rating = Input::get('rating'); |
|
65 | + $this->course->slope = Input::get('slope'); |
|
66 | + $this->course->save(); |
|
67 | + break; |
|
68 | + case "del": |
|
69 | + $id = Input::get('id'); |
|
70 | + $this->course = $this->course->destroy($id); |
|
71 | + break; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 |
@@ -41,7 +41,6 @@ |
||
41 | 41 | /** |
42 | 42 | * Display the specified resource. |
43 | 43 | * |
44 | - * @param int $course_id |
|
45 | 44 | * @return Response |
46 | 45 | */ |
47 | 46 | public function show() |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | class HolesController extends \BaseController { |
4 | 4 | |
5 | 5 | public function __construct(Course $course, Hole $hole) |
6 | - { |
|
6 | + { |
|
7 | 7 | $this->course = $course; |
8 | 8 | $this->hole = $hole; |
9 | - } |
|
9 | + } |
|
10 | 10 | /** |
11 | 11 | * Display a listing of the resource. |
12 | 12 | * |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public function index() |
16 | 16 | { |
17 | 17 | $data = $this->hole->all(); |
18 | - return $data; |
|
18 | + return $data; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -3,7 +3,7 @@ |
||
3 | 3 | class HolesController extends \BaseController { |
4 | 4 | |
5 | 5 | public function __construct(Course $course, Hole $hole) |
6 | - { |
|
6 | + { |
|
7 | 7 | $this->course = $course; |
8 | 8 | $this->hole = $hole; |
9 | 9 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | /** |
14 | 14 | * Display a listing of the resource. |
15 | 15 | * |
16 | - * @return Response |
|
16 | + * @return string |
|
17 | 17 | */ |
18 | 18 | public function index() |
19 | 19 | { |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | class LiveLeaderboardController extends \BaseController { |
7 | 7 | |
8 | 8 | public function __construct(LeaderboardService $leaderboard) |
9 | - { |
|
10 | - $this->leaderboard = $leaderboard; |
|
11 | - } |
|
9 | + { |
|
10 | + $this->leaderboard = $leaderboard; |
|
11 | + } |
|
12 | 12 | |
13 | - /** |
|
13 | + /** |
|
14 | 14 | * Display a listing of the resource. |
15 | 15 | * |
16 | 16 | * @return Response |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function show($id) |
53 | 53 | { |
54 | - $match = Input::get('match'); |
|
55 | - $type = $id; |
|
54 | + $match = Input::get('match'); |
|
55 | + $type = $id; |
|
56 | 56 | |
57 | - //return net or gross leaderboard for live scoring |
|
57 | + //return net or gross leaderboard for live scoring |
|
58 | 58 | $data['data'] = $this->leaderboard->calculate($match,$type); |
59 | - return $data; |
|
59 | + return $data; |
|
60 | 60 | |
61 | 61 | } |
62 | 62 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $type = $id; |
56 | 56 | |
57 | 57 | //return net or gross leaderboard for live scoring |
58 | - $data['data'] = $this->leaderboard->calculate($match,$type); |
|
58 | + $data['data'] = $this->leaderboard->calculate($match, $type); |
|
59 | 59 | return $data; |
60 | 60 | |
61 | 61 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | class LiveLeaderboardController extends \BaseController { |
7 | 7 | |
8 | 8 | public function __construct(LeaderboardService $leaderboard) |
9 | - { |
|
9 | + { |
|
10 | 10 | $this->leaderboard = $leaderboard; |
11 | 11 | } |
12 | 12 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | /** |
22 | 22 | * Create a new instance of the MatchHandler |
23 | 23 | * |
24 | - * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
24 | + * @param RoundRepository $roundRepo |
|
25 | 25 | * @return void |
26 | 26 | */ |
27 | 27 | public function __construct(RoundRepository $roundRepo) |
@@ -18,130 +18,130 @@ |
||
18 | 18 | */ |
19 | 19 | class FinalizeHandler |
20 | 20 | { |
21 | - /** |
|
22 | - * Create a new instance of the MatchHandler |
|
23 | - * |
|
24 | - * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
25 | - * @return void |
|
26 | - */ |
|
27 | - public function __construct(RoundRepository $roundRepo) |
|
28 | - { |
|
29 | - $this->roundRepo= $roundRepo; |
|
30 | - } // End of __construct |
|
21 | + /** |
|
22 | + * Create a new instance of the MatchHandler |
|
23 | + * |
|
24 | + * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
25 | + * @return void |
|
26 | + */ |
|
27 | + public function __construct(RoundRepository $roundRepo) |
|
28 | + { |
|
29 | + $this->roundRepo= $roundRepo; |
|
30 | + } // End of __construct |
|
31 | 31 | |
32 | - /** |
|
33 | - * Create an initial round for each player after a new match is created |
|
34 | - * |
|
35 | - * @param Match $match |
|
36 | - * @return void |
|
37 | - */ |
|
38 | - public function handle($match) |
|
39 | - { |
|
40 | - //for the match get ctps, netwinner, grosswinner, and skins |
|
41 | - //calculate winnings |
|
42 | - //store in the pivot table match_player for the given player |
|
32 | + /** |
|
33 | + * Create an initial round for each player after a new match is created |
|
34 | + * |
|
35 | + * @param Match $match |
|
36 | + * @return void |
|
37 | + */ |
|
38 | + public function handle($match) |
|
39 | + { |
|
40 | + //for the match get ctps, netwinner, grosswinner, and skins |
|
41 | + //calculate winnings |
|
42 | + //store in the pivot table match_player for the given player |
|
43 | 43 | |
44 | - $winningPlayers = array(); |
|
45 | - $i = 1; |
|
44 | + $winningPlayers = array(); |
|
45 | + $i = 1; |
|
46 | 46 | |
47 | - $ctpWinners = Ctp::where('match_id', '=', $match->id)->get(); |
|
48 | - foreach($ctpWinners as $key => $ctpWinner){ |
|
49 | - $playerExists = $this->recursive_array_search($ctpWinner->player_id, $winningPlayers); |
|
50 | - //if player is already there add money here to other money |
|
51 | - if($playerExists){ |
|
52 | - $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
|
53 | - $winningPlayers[$i]['money'] = ($ctpWinner->money + $winningPlayers[$playerExists]['money']); |
|
54 | - unset($winningPlayers[$playerExists]); |
|
55 | - } |
|
56 | - else { |
|
57 | - $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
|
58 | - $winningPlayers[$i]['money'] = $ctpWinner->money; |
|
59 | - } |
|
60 | - $i++; |
|
61 | - } |
|
47 | + $ctpWinners = Ctp::where('match_id', '=', $match->id)->get(); |
|
48 | + foreach($ctpWinners as $key => $ctpWinner){ |
|
49 | + $playerExists = $this->recursive_array_search($ctpWinner->player_id, $winningPlayers); |
|
50 | + //if player is already there add money here to other money |
|
51 | + if($playerExists){ |
|
52 | + $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
|
53 | + $winningPlayers[$i]['money'] = ($ctpWinner->money + $winningPlayers[$playerExists]['money']); |
|
54 | + unset($winningPlayers[$playerExists]); |
|
55 | + } |
|
56 | + else { |
|
57 | + $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
|
58 | + $winningPlayers[$i]['money'] = $ctpWinner->money; |
|
59 | + } |
|
60 | + $i++; |
|
61 | + } |
|
62 | 62 | |
63 | - $netWinners = Netwinner::where('match_id', '=', $match->id)->get(); |
|
64 | - foreach($netWinners as $key => $netWinner){ |
|
65 | - $playerExists = $this->recursive_array_search($netWinner->player_id, $winningPlayers); |
|
66 | - //if player is already there add money here to other money |
|
67 | - if($playerExists){ |
|
68 | - $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
|
69 | - $winningPlayers[$i]['money'] = ($netWinner->money + $winningPlayers[$playerExists]['money']); |
|
70 | - unset($winningPlayers[$playerExists]); |
|
71 | - } |
|
72 | - else{ |
|
73 | - $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
|
74 | - $winningPlayers[$i]['money'] = $netWinner->money; |
|
75 | - } |
|
76 | - $i++; |
|
77 | - } |
|
63 | + $netWinners = Netwinner::where('match_id', '=', $match->id)->get(); |
|
64 | + foreach($netWinners as $key => $netWinner){ |
|
65 | + $playerExists = $this->recursive_array_search($netWinner->player_id, $winningPlayers); |
|
66 | + //if player is already there add money here to other money |
|
67 | + if($playerExists){ |
|
68 | + $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
|
69 | + $winningPlayers[$i]['money'] = ($netWinner->money + $winningPlayers[$playerExists]['money']); |
|
70 | + unset($winningPlayers[$playerExists]); |
|
71 | + } |
|
72 | + else{ |
|
73 | + $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
|
74 | + $winningPlayers[$i]['money'] = $netWinner->money; |
|
75 | + } |
|
76 | + $i++; |
|
77 | + } |
|
78 | 78 | |
79 | - $grossWinners = Grosswinner::where('match_id', '=', $match->id)->get(); |
|
80 | - foreach($grossWinners as $key => $grossWinner){ |
|
81 | - $playerExists = $this->recursive_array_search($grossWinner->player_id, $winningPlayers); |
|
82 | - //if player is already there add money here to other money |
|
83 | - if($playerExists){ |
|
84 | - $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
|
85 | - $winningPlayers[$i]['money'] = ($grossWinner->money + $winningPlayers[$playerExists]['money']); |
|
86 | - unset($winningPlayers[$playerExists]); |
|
87 | - } |
|
88 | - else{ |
|
89 | - $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
|
90 | - $winningPlayers[$i]['money'] = $grossWinner->money; |
|
91 | - } |
|
92 | - $i++; |
|
93 | - } |
|
79 | + $grossWinners = Grosswinner::where('match_id', '=', $match->id)->get(); |
|
80 | + foreach($grossWinners as $key => $grossWinner){ |
|
81 | + $playerExists = $this->recursive_array_search($grossWinner->player_id, $winningPlayers); |
|
82 | + //if player is already there add money here to other money |
|
83 | + if($playerExists){ |
|
84 | + $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
|
85 | + $winningPlayers[$i]['money'] = ($grossWinner->money + $winningPlayers[$playerExists]['money']); |
|
86 | + unset($winningPlayers[$playerExists]); |
|
87 | + } |
|
88 | + else{ |
|
89 | + $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
|
90 | + $winningPlayers[$i]['money'] = $grossWinner->money; |
|
91 | + } |
|
92 | + $i++; |
|
93 | + } |
|
94 | 94 | |
95 | - $skinWinners = Skin::where('match_id', '=', $match->id)->get(); |
|
96 | - foreach($skinWinners as $key => $skinWinner){ |
|
97 | - $playerExists = $this->recursive_array_search($skinWinner->player_id, $winningPlayers); |
|
98 | - //if player is already there add money here to other money |
|
99 | - if($playerExists){ |
|
100 | - $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
|
101 | - $winningPlayers[$i]['money'] = ($skinWinner->money + $winningPlayers[$playerExists]['money']); |
|
102 | - unset($winningPlayers[$playerExists]); |
|
103 | - } |
|
104 | - else{ |
|
105 | - $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
|
106 | - $winningPlayers[$i]['money'] = $skinWinner->money; |
|
107 | - } |
|
108 | - $i++; |
|
109 | - } |
|
95 | + $skinWinners = Skin::where('match_id', '=', $match->id)->get(); |
|
96 | + foreach($skinWinners as $key => $skinWinner){ |
|
97 | + $playerExists = $this->recursive_array_search($skinWinner->player_id, $winningPlayers); |
|
98 | + //if player is already there add money here to other money |
|
99 | + if($playerExists){ |
|
100 | + $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
|
101 | + $winningPlayers[$i]['money'] = ($skinWinner->money + $winningPlayers[$playerExists]['money']); |
|
102 | + unset($winningPlayers[$playerExists]); |
|
103 | + } |
|
104 | + else{ |
|
105 | + $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
|
106 | + $winningPlayers[$i]['money'] = $skinWinner->money; |
|
107 | + } |
|
108 | + $i++; |
|
109 | + } |
|
110 | 110 | |
111 | - //Consolidate any multiple instances of a player |
|
112 | - foreach ($winningPlayers as $key => $winningPlayer){ |
|
113 | - array_search($winningPlayer['player_id'], $winningPlayers); |
|
114 | - } |
|
111 | + //Consolidate any multiple instances of a player |
|
112 | + foreach ($winningPlayers as $key => $winningPlayer){ |
|
113 | + array_search($winningPlayer['player_id'], $winningPlayers); |
|
114 | + } |
|
115 | 115 | |
116 | - foreach ($winningPlayers as $key => $player){ |
|
117 | - $currentPlayer = Player::find($player['player_id']); |
|
118 | - $attributes = array( |
|
119 | - "winnings" => $player['money'] |
|
120 | - ); |
|
121 | - $currentPlayer->matches()->updateExistingPivot($match->id, $attributes); //save match_player pivot data |
|
122 | - }// End foreach |
|
116 | + foreach ($winningPlayers as $key => $player){ |
|
117 | + $currentPlayer = Player::find($player['player_id']); |
|
118 | + $attributes = array( |
|
119 | + "winnings" => $player['money'] |
|
120 | + ); |
|
121 | + $currentPlayer->matches()->updateExistingPivot($match->id, $attributes); //save match_player pivot data |
|
122 | + }// End foreach |
|
123 | 123 | |
124 | 124 | |
125 | - } |
|
125 | + } |
|
126 | 126 | |
127 | - /** |
|
128 | - * Register the listeners for the subscriber. |
|
129 | - * |
|
130 | - * @param Illuminate\Events\Dispatcher $events |
|
131 | - * @return array |
|
132 | - */ |
|
133 | - public function subscribe($events) |
|
134 | - { |
|
135 | - $events->listen('match.finalize', 'GolfLeague\Handlers\FinalizeHandler'); |
|
136 | - } |
|
127 | + /** |
|
128 | + * Register the listeners for the subscriber. |
|
129 | + * |
|
130 | + * @param Illuminate\Events\Dispatcher $events |
|
131 | + * @return array |
|
132 | + */ |
|
133 | + public function subscribe($events) |
|
134 | + { |
|
135 | + $events->listen('match.finalize', 'GolfLeague\Handlers\FinalizeHandler'); |
|
136 | + } |
|
137 | 137 | |
138 | - public function recursive_array_search($needle,$haystack) { |
|
139 | - foreach($haystack as $key=>$value) { |
|
140 | - $current_key=$key; |
|
141 | - if($needle===$value || (is_array($value) && $this->recursive_array_search($needle,$value) !== false)) { |
|
142 | - return $current_key; |
|
143 | - } |
|
144 | - } |
|
145 | - return false; |
|
146 | - } |
|
138 | + public function recursive_array_search($needle,$haystack) { |
|
139 | + foreach($haystack as $key=>$value) { |
|
140 | + $current_key=$key; |
|
141 | + if($needle===$value || (is_array($value) && $this->recursive_array_search($needle,$value) !== false)) { |
|
142 | + return $current_key; |
|
143 | + } |
|
144 | + } |
|
145 | + return false; |
|
146 | + } |
|
147 | 147 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct(RoundRepository $roundRepo) |
28 | 28 | { |
29 | - $this->roundRepo= $roundRepo; |
|
29 | + $this->roundRepo = $roundRepo; |
|
30 | 30 | } // End of __construct |
31 | 31 | |
32 | 32 | /** |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | $i = 1; |
46 | 46 | |
47 | 47 | $ctpWinners = Ctp::where('match_id', '=', $match->id)->get(); |
48 | - foreach($ctpWinners as $key => $ctpWinner){ |
|
48 | + foreach ($ctpWinners as $key => $ctpWinner) { |
|
49 | 49 | $playerExists = $this->recursive_array_search($ctpWinner->player_id, $winningPlayers); |
50 | 50 | //if player is already there add money here to other money |
51 | - if($playerExists){ |
|
51 | + if ($playerExists) { |
|
52 | 52 | $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
53 | 53 | $winningPlayers[$i]['money'] = ($ctpWinner->money + $winningPlayers[$playerExists]['money']); |
54 | 54 | unset($winningPlayers[$playerExists]); |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | $netWinners = Netwinner::where('match_id', '=', $match->id)->get(); |
64 | - foreach($netWinners as $key => $netWinner){ |
|
64 | + foreach ($netWinners as $key => $netWinner) { |
|
65 | 65 | $playerExists = $this->recursive_array_search($netWinner->player_id, $winningPlayers); |
66 | 66 | //if player is already there add money here to other money |
67 | - if($playerExists){ |
|
67 | + if ($playerExists) { |
|
68 | 68 | $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
69 | 69 | $winningPlayers[$i]['money'] = ($netWinner->money + $winningPlayers[$playerExists]['money']); |
70 | 70 | unset($winningPlayers[$playerExists]); |
71 | 71 | } |
72 | - else{ |
|
72 | + else { |
|
73 | 73 | $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
74 | 74 | $winningPlayers[$i]['money'] = $netWinner->money; |
75 | 75 | } |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | $grossWinners = Grosswinner::where('match_id', '=', $match->id)->get(); |
80 | - foreach($grossWinners as $key => $grossWinner){ |
|
80 | + foreach ($grossWinners as $key => $grossWinner) { |
|
81 | 81 | $playerExists = $this->recursive_array_search($grossWinner->player_id, $winningPlayers); |
82 | 82 | //if player is already there add money here to other money |
83 | - if($playerExists){ |
|
83 | + if ($playerExists) { |
|
84 | 84 | $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
85 | 85 | $winningPlayers[$i]['money'] = ($grossWinner->money + $winningPlayers[$playerExists]['money']); |
86 | 86 | unset($winningPlayers[$playerExists]); |
87 | 87 | } |
88 | - else{ |
|
88 | + else { |
|
89 | 89 | $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
90 | 90 | $winningPlayers[$i]['money'] = $grossWinner->money; |
91 | 91 | } |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | $skinWinners = Skin::where('match_id', '=', $match->id)->get(); |
96 | - foreach($skinWinners as $key => $skinWinner){ |
|
96 | + foreach ($skinWinners as $key => $skinWinner) { |
|
97 | 97 | $playerExists = $this->recursive_array_search($skinWinner->player_id, $winningPlayers); |
98 | 98 | //if player is already there add money here to other money |
99 | - if($playerExists){ |
|
99 | + if ($playerExists) { |
|
100 | 100 | $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
101 | 101 | $winningPlayers[$i]['money'] = ($skinWinner->money + $winningPlayers[$playerExists]['money']); |
102 | 102 | unset($winningPlayers[$playerExists]); |
103 | 103 | } |
104 | - else{ |
|
104 | + else { |
|
105 | 105 | $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
106 | 106 | $winningPlayers[$i]['money'] = $skinWinner->money; |
107 | 107 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | //Consolidate any multiple instances of a player |
112 | - foreach ($winningPlayers as $key => $winningPlayer){ |
|
112 | + foreach ($winningPlayers as $key => $winningPlayer) { |
|
113 | 113 | array_search($winningPlayer['player_id'], $winningPlayers); |
114 | 114 | } |
115 | 115 | |
116 | - foreach ($winningPlayers as $key => $player){ |
|
116 | + foreach ($winningPlayers as $key => $player) { |
|
117 | 117 | $currentPlayer = Player::find($player['player_id']); |
118 | 118 | $attributes = array( |
119 | 119 | "winnings" => $player['money'] |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | $events->listen('match.finalize', 'GolfLeague\Handlers\FinalizeHandler'); |
136 | 136 | } |
137 | 137 | |
138 | - public function recursive_array_search($needle,$haystack) { |
|
139 | - foreach($haystack as $key=>$value) { |
|
140 | - $current_key=$key; |
|
141 | - if($needle===$value || (is_array($value) && $this->recursive_array_search($needle,$value) !== false)) { |
|
138 | + public function recursive_array_search($needle, $haystack) { |
|
139 | + foreach ($haystack as $key=>$value) { |
|
140 | + $current_key = $key; |
|
141 | + if ($needle === $value || (is_array($value) && $this->recursive_array_search($needle, $value) !== false)) { |
|
142 | 142 | return $current_key; |
143 | 143 | } |
144 | 144 | } |
@@ -16,8 +16,7 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @author Michael Schmidt |
18 | 18 | */ |
19 | -class FinalizeHandler |
|
20 | -{ |
|
19 | +class FinalizeHandler { |
|
21 | 20 | /** |
22 | 21 | * Create a new instance of the MatchHandler |
23 | 22 | * |
@@ -45,15 +44,14 @@ discard block |
||
45 | 44 | $i = 1; |
46 | 45 | |
47 | 46 | $ctpWinners = Ctp::where('match_id', '=', $match->id)->get(); |
48 | - foreach($ctpWinners as $key => $ctpWinner){ |
|
47 | + foreach($ctpWinners as $key => $ctpWinner) { |
|
49 | 48 | $playerExists = $this->recursive_array_search($ctpWinner->player_id, $winningPlayers); |
50 | 49 | //if player is already there add money here to other money |
51 | - if($playerExists){ |
|
50 | + if($playerExists) { |
|
52 | 51 | $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
53 | 52 | $winningPlayers[$i]['money'] = ($ctpWinner->money + $winningPlayers[$playerExists]['money']); |
54 | 53 | unset($winningPlayers[$playerExists]); |
55 | - } |
|
56 | - else { |
|
54 | + } else { |
|
57 | 55 | $winningPlayers[$i]['player_id'] = $ctpWinner->player_id; |
58 | 56 | $winningPlayers[$i]['money'] = $ctpWinner->money; |
59 | 57 | } |
@@ -61,15 +59,14 @@ discard block |
||
61 | 59 | } |
62 | 60 | |
63 | 61 | $netWinners = Netwinner::where('match_id', '=', $match->id)->get(); |
64 | - foreach($netWinners as $key => $netWinner){ |
|
62 | + foreach($netWinners as $key => $netWinner) { |
|
65 | 63 | $playerExists = $this->recursive_array_search($netWinner->player_id, $winningPlayers); |
66 | 64 | //if player is already there add money here to other money |
67 | - if($playerExists){ |
|
65 | + if($playerExists) { |
|
68 | 66 | $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
69 | 67 | $winningPlayers[$i]['money'] = ($netWinner->money + $winningPlayers[$playerExists]['money']); |
70 | 68 | unset($winningPlayers[$playerExists]); |
71 | - } |
|
72 | - else{ |
|
69 | + } else { |
|
73 | 70 | $winningPlayers[$i]['player_id'] = $netWinner->player_id; |
74 | 71 | $winningPlayers[$i]['money'] = $netWinner->money; |
75 | 72 | } |
@@ -77,15 +74,14 @@ discard block |
||
77 | 74 | } |
78 | 75 | |
79 | 76 | $grossWinners = Grosswinner::where('match_id', '=', $match->id)->get(); |
80 | - foreach($grossWinners as $key => $grossWinner){ |
|
77 | + foreach($grossWinners as $key => $grossWinner) { |
|
81 | 78 | $playerExists = $this->recursive_array_search($grossWinner->player_id, $winningPlayers); |
82 | 79 | //if player is already there add money here to other money |
83 | - if($playerExists){ |
|
80 | + if($playerExists) { |
|
84 | 81 | $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
85 | 82 | $winningPlayers[$i]['money'] = ($grossWinner->money + $winningPlayers[$playerExists]['money']); |
86 | 83 | unset($winningPlayers[$playerExists]); |
87 | - } |
|
88 | - else{ |
|
84 | + } else { |
|
89 | 85 | $winningPlayers[$i]['player_id'] = $grossWinner->player_id; |
90 | 86 | $winningPlayers[$i]['money'] = $grossWinner->money; |
91 | 87 | } |
@@ -93,15 +89,14 @@ discard block |
||
93 | 89 | } |
94 | 90 | |
95 | 91 | $skinWinners = Skin::where('match_id', '=', $match->id)->get(); |
96 | - foreach($skinWinners as $key => $skinWinner){ |
|
92 | + foreach($skinWinners as $key => $skinWinner) { |
|
97 | 93 | $playerExists = $this->recursive_array_search($skinWinner->player_id, $winningPlayers); |
98 | 94 | //if player is already there add money here to other money |
99 | - if($playerExists){ |
|
95 | + if($playerExists) { |
|
100 | 96 | $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
101 | 97 | $winningPlayers[$i]['money'] = ($skinWinner->money + $winningPlayers[$playerExists]['money']); |
102 | 98 | unset($winningPlayers[$playerExists]); |
103 | - } |
|
104 | - else{ |
|
99 | + } else { |
|
105 | 100 | $winningPlayers[$i]['player_id'] = $skinWinner->player_id; |
106 | 101 | $winningPlayers[$i]['money'] = $skinWinner->money; |
107 | 102 | } |
@@ -109,11 +104,11 @@ discard block |
||
109 | 104 | } |
110 | 105 | |
111 | 106 | //Consolidate any multiple instances of a player |
112 | - foreach ($winningPlayers as $key => $winningPlayer){ |
|
107 | + foreach ($winningPlayers as $key => $winningPlayer) { |
|
113 | 108 | array_search($winningPlayer['player_id'], $winningPlayers); |
114 | 109 | } |
115 | 110 | |
116 | - foreach ($winningPlayers as $key => $player){ |
|
111 | + foreach ($winningPlayers as $key => $player) { |
|
117 | 112 | $currentPlayer = Player::find($player['player_id']); |
118 | 113 | $attributes = array( |
119 | 114 | "winnings" => $player['money'] |
@@ -135,7 +130,8 @@ discard block |
||
135 | 130 | $events->listen('match.finalize', 'GolfLeague\Handlers\FinalizeHandler'); |
136 | 131 | } |
137 | 132 | |
138 | - public function recursive_array_search($needle,$haystack) { |
|
133 | + public function recursive_array_search($needle,$haystack) |
|
134 | + { |
|
139 | 135 | foreach($haystack as $key=>$value) { |
140 | 136 | $current_key=$key; |
141 | 137 | if($needle===$value || (is_array($value) && $this->recursive_array_search($needle,$value) !== false)) { |
@@ -17,7 +17,6 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Create a new instance of the MatchHandler |
19 | 19 | * |
20 | - * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
21 | 20 | * @return void |
22 | 21 | */ |
23 | 22 | public function __construct(HoleScoreRepository $holescoreRepo) |
@@ -28,7 +27,6 @@ discard block |
||
28 | 27 | /** |
29 | 28 | * Create an initial round for each player after a new match is created |
30 | 29 | * |
31 | - * @param Match $match |
|
32 | 30 | * @return void |
33 | 31 | */ |
34 | 32 | public function handle($round) |
@@ -14,47 +14,47 @@ |
||
14 | 14 | */ |
15 | 15 | class RoundHandler |
16 | 16 | { |
17 | - /** |
|
18 | - * Create a new instance of the MatchHandler |
|
19 | - * |
|
20 | - * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function __construct(HoleScoreRepository $holescoreRepo) |
|
24 | - { |
|
25 | - $this->holescoreRepo= $holescoreRepo; |
|
26 | - } // End of __construct |
|
27 | - |
|
28 | - /** |
|
29 | - * Create an initial round for each player after a new match is created |
|
30 | - * |
|
31 | - * @param Match $match |
|
32 | - * @return void |
|
33 | - */ |
|
34 | - public function handle($round) |
|
35 | - { |
|
36 | - $holes = Hole::where('course_id', '=', $round['course_id'])->get(); |
|
37 | - foreach($holes as $hole){ |
|
38 | - $input = array( |
|
39 | - 'score' => null, |
|
40 | - 'hole_id' => $hole->id, |
|
41 | - 'round_id' => $round['id'] |
|
42 | - ); |
|
43 | - $this->holescoreRepo->create($input); |
|
44 | - } |
|
45 | - |
|
46 | - |
|
47 | - |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * Register the listeners for the subscriber. |
|
52 | - * |
|
53 | - * @param Illuminate\Events\Dispatcher $events |
|
54 | - * @return array |
|
55 | - */ |
|
56 | - public function subscribe($events) |
|
57 | - { |
|
58 | - $events->listen('eloquent.created: Round', 'GolfLeague\Handlers\RoundHandler'); |
|
59 | - } |
|
17 | + /** |
|
18 | + * Create a new instance of the MatchHandler |
|
19 | + * |
|
20 | + * @param GolfLeague\Storage\Round\RoundRepository $roundRepo |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function __construct(HoleScoreRepository $holescoreRepo) |
|
24 | + { |
|
25 | + $this->holescoreRepo= $holescoreRepo; |
|
26 | + } // End of __construct |
|
27 | + |
|
28 | + /** |
|
29 | + * Create an initial round for each player after a new match is created |
|
30 | + * |
|
31 | + * @param Match $match |
|
32 | + * @return void |
|
33 | + */ |
|
34 | + public function handle($round) |
|
35 | + { |
|
36 | + $holes = Hole::where('course_id', '=', $round['course_id'])->get(); |
|
37 | + foreach($holes as $hole){ |
|
38 | + $input = array( |
|
39 | + 'score' => null, |
|
40 | + 'hole_id' => $hole->id, |
|
41 | + 'round_id' => $round['id'] |
|
42 | + ); |
|
43 | + $this->holescoreRepo->create($input); |
|
44 | + } |
|
45 | + |
|
46 | + |
|
47 | + |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * Register the listeners for the subscriber. |
|
52 | + * |
|
53 | + * @param Illuminate\Events\Dispatcher $events |
|
54 | + * @return array |
|
55 | + */ |
|
56 | + public function subscribe($events) |
|
57 | + { |
|
58 | + $events->listen('eloquent.created: Round', 'GolfLeague\Handlers\RoundHandler'); |
|
59 | + } |
|
60 | 60 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct(HoleScoreRepository $holescoreRepo) |
24 | 24 | { |
25 | - $this->holescoreRepo= $holescoreRepo; |
|
25 | + $this->holescoreRepo = $holescoreRepo; |
|
26 | 26 | } // End of __construct |
27 | 27 | |
28 | 28 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | public function handle($round) |
35 | 35 | { |
36 | 36 | $holes = Hole::where('course_id', '=', $round['course_id'])->get(); |
37 | - foreach($holes as $hole){ |
|
37 | + foreach ($holes as $hole) { |
|
38 | 38 | $input = array( |
39 | 39 | 'score' => null, |
40 | 40 | 'hole_id' => $hole->id, |
@@ -12,8 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | * @author Michael Schmidt |
14 | 14 | */ |
15 | -class RoundHandler |
|
16 | -{ |
|
15 | +class RoundHandler { |
|
17 | 16 | /** |
18 | 17 | * Create a new instance of the MatchHandler |
19 | 18 | * |
@@ -34,7 +33,7 @@ discard block |
||
34 | 33 | public function handle($round) |
35 | 34 | { |
36 | 35 | $holes = Hole::where('course_id', '=', $round['course_id'])->get(); |
37 | - foreach($holes as $hole){ |
|
36 | + foreach($holes as $hole) { |
|
38 | 37 | $input = array( |
39 | 38 | 'score' => null, |
40 | 39 | 'hole_id' => $hole->id, |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Loads our $matchRepo |
17 | 17 | * |
18 | - * @param MatchRepository $matchRepo |
|
18 | + * @param MatchRepository $matchRoundRepo |
|
19 | 19 | * @return MatchService |
20 | 20 | */ |
21 | 21 | public function __construct(MatchRoundRepository $matchRoundRepo, RoundRepository $roundRepo, MatchRepository $match) |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Method to get match data from input Match id |
34 | 34 | * |
35 | - * @param mixed $matchdata |
|
35 | + * @param mixed $matchId |
|
36 | 36 | * @return JSON object |
37 | 37 | */ |
38 | 38 | public function getByMatch($matchId) |
@@ -9,41 +9,41 @@ |
||
9 | 9 | */ |
10 | 10 | class MatchRoundService |
11 | 11 | { |
12 | - // Containing our pokemonRepository to make all our database calls to |
|
13 | - protected $matchRepo; |
|
12 | + // Containing our pokemonRepository to make all our database calls to |
|
13 | + protected $matchRepo; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Loads our $matchRepo |
|
17 | - * |
|
18 | - * @param MatchRepository $matchRepo |
|
19 | - * @return MatchService |
|
20 | - */ |
|
21 | - public function __construct(MatchRoundRepository $matchRoundRepo, RoundRepository $roundRepo, MatchRepository $match) |
|
22 | - { |
|
23 | - $this->matchRoundRepo = $matchRoundRepo; |
|
24 | - $this->roundRepo = $roundRepo; |
|
25 | - $this->match = $match; |
|
26 | - } |
|
15 | + /** |
|
16 | + * Loads our $matchRepo |
|
17 | + * |
|
18 | + * @param MatchRepository $matchRepo |
|
19 | + * @return MatchService |
|
20 | + */ |
|
21 | + public function __construct(MatchRoundRepository $matchRoundRepo, RoundRepository $roundRepo, MatchRepository $match) |
|
22 | + { |
|
23 | + $this->matchRoundRepo = $matchRoundRepo; |
|
24 | + $this->roundRepo = $roundRepo; |
|
25 | + $this->match = $match; |
|
26 | + } |
|
27 | 27 | |
28 | - public function all() |
|
29 | - { |
|
30 | - return $this->matchRoundRepo->all(); |
|
31 | - } |
|
32 | - /** |
|
33 | - * Method to get match data from input Match id |
|
34 | - * |
|
35 | - * @param mixed $matchdata |
|
36 | - * @return JSON object |
|
37 | - */ |
|
38 | - public function getByMatch($matchId) |
|
39 | - { |
|
40 | - return $this->matchRoundRepo->getByMatch($matchId); |
|
41 | - } |
|
28 | + public function all() |
|
29 | + { |
|
30 | + return $this->matchRoundRepo->all(); |
|
31 | + } |
|
32 | + /** |
|
33 | + * Method to get match data from input Match id |
|
34 | + * |
|
35 | + * @param mixed $matchdata |
|
36 | + * @return JSON object |
|
37 | + */ |
|
38 | + public function getByMatch($matchId) |
|
39 | + { |
|
40 | + return $this->matchRoundRepo->getByMatch($matchId); |
|
41 | + } |
|
42 | 42 | |
43 | - public function getByMatchAndGroup($matchdata) |
|
44 | - { |
|
45 | - //Retrieve players in group |
|
46 | - $players = $this->matchRoundRepo->matchGroup($matchdata['match_id'], $matchdata['group']); |
|
47 | - return $players; |
|
48 | - } |
|
43 | + public function getByMatchAndGroup($matchdata) |
|
44 | + { |
|
45 | + //Retrieve players in group |
|
46 | + $players = $this->matchRoundRepo->matchGroup($matchdata['match_id'], $matchdata['group']); |
|
47 | + return $players; |
|
48 | + } |
|
49 | 49 | } |
@@ -7,8 +7,7 @@ |
||
7 | 7 | /** |
8 | 8 | * Our MatchService, containing all useful methods for business logic around Matches |
9 | 9 | */ |
10 | -class MatchRoundService |
|
11 | -{ |
|
10 | +class MatchRoundService { |
|
12 | 11 | // Containing our pokemonRepository to make all our database calls to |
13 | 12 | protected $matchRepo; |
14 | 13 |
@@ -21,7 +21,6 @@ |
||
21 | 21 | /** |
22 | 22 | * Loads our $matchRepo |
23 | 23 | * |
24 | - * @param MatchRepository $matchRepo |
|
25 | 24 | * @return MatchService |
26 | 25 | */ |
27 | 26 | public function __construct() |
@@ -7,8 +7,6 @@ |
||
7 | 7 | use \Netwinner; |
8 | 8 | use \Skin; |
9 | 9 | |
10 | -use Illuminate\Events\Dispatcher; |
|
11 | - |
|
12 | 10 | /** |
13 | 11 | * MoneyService, containing all useful methods for business logic for money relating to a match |
14 | 12 | */ |
@@ -15,28 +15,28 @@ |
||
15 | 15 | class MoneyService |
16 | 16 | { |
17 | 17 | |
18 | - // Containing our matchRepository to make all our database calls |
|
19 | - protected $matchRepo; |
|
18 | + // Containing our matchRepository to make all our database calls |
|
19 | + protected $matchRepo; |
|
20 | 20 | |
21 | - /** |
|
22 | - * Loads our $matchRepo |
|
23 | - * |
|
24 | - * @param MatchRepository $matchRepo |
|
25 | - * @return MatchService |
|
26 | - */ |
|
27 | - public function __construct() |
|
28 | - { |
|
21 | + /** |
|
22 | + * Loads our $matchRepo |
|
23 | + * |
|
24 | + * @param MatchRepository $matchRepo |
|
25 | + * @return MatchService |
|
26 | + */ |
|
27 | + public function __construct() |
|
28 | + { |
|
29 | 29 | |
30 | - } |
|
30 | + } |
|
31 | 31 | |
32 | - public function totalMatchMoney($matchId) |
|
33 | - { |
|
34 | - //get player id and money for ctp |
|
35 | - $results['ctps'] = Ctp::with('player')->where('match_id', '=', $matchId)->get(); |
|
36 | - $results['skins'] = Skin::with('player', 'hole')->where('match_id', '=', $matchId)->get(); |
|
37 | - $results['netwinner'] = Netwinner::with('player')->where('match_id', '=', $matchId)->get(); |
|
38 | - $results['grosswinner'] = Grosswinner::with('player')->where('match_id', '=', $matchId)->get(); |
|
39 | - $results['moneylist'] = Match::with('players')->where('id', '=', $matchId)->get(); |
|
32 | + public function totalMatchMoney($matchId) |
|
33 | + { |
|
34 | + //get player id and money for ctp |
|
35 | + $results['ctps'] = Ctp::with('player')->where('match_id', '=', $matchId)->get(); |
|
36 | + $results['skins'] = Skin::with('player', 'hole')->where('match_id', '=', $matchId)->get(); |
|
37 | + $results['netwinner'] = Netwinner::with('player')->where('match_id', '=', $matchId)->get(); |
|
38 | + $results['grosswinner'] = Grosswinner::with('player')->where('match_id', '=', $matchId)->get(); |
|
39 | + $results['moneylist'] = Match::with('players')->where('id', '=', $matchId)->get(); |
|
40 | 40 | return $results; |
41 | - } |
|
41 | + } |
|
42 | 42 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function totalMatchMoney($matchId) |
33 | 33 | { |
34 | 34 | //get player id and money for ctp |
35 | - $results['ctps'] = Ctp::with('player')->where('match_id', '=', $matchId)->get(); |
|
35 | + $results['ctps'] = Ctp::with('player')->where('match_id', '=', $matchId)->get(); |
|
36 | 36 | $results['skins'] = Skin::with('player', 'hole')->where('match_id', '=', $matchId)->get(); |
37 | 37 | $results['netwinner'] = Netwinner::with('player')->where('match_id', '=', $matchId)->get(); |
38 | 38 | $results['grosswinner'] = Grosswinner::with('player')->where('match_id', '=', $matchId)->get(); |
@@ -12,8 +12,7 @@ |
||
12 | 12 | /** |
13 | 13 | * MoneyService, containing all useful methods for business logic for money relating to a match |
14 | 14 | */ |
15 | -class MoneyService |
|
16 | -{ |
|
15 | +class MoneyService { |
|
17 | 16 | |
18 | 17 | // Containing our matchRepository to make all our database calls |
19 | 18 | protected $matchRepo; |
@@ -14,6 +14,6 @@ |
||
14 | 14 | |
15 | 15 | public function courses() |
16 | 16 | { |
17 | - return $this->hasManyThrough('Course','Holescore'); |
|
17 | + return $this->hasManyThrough('Course', 'Holescore'); |
|
18 | 18 | } |
19 | 19 | } |
@@ -2,20 +2,20 @@ |
||
2 | 2 | |
3 | 3 | class Hole extends Eloquent |
4 | 4 | { |
5 | - protected $fillable = ['course_id', 'number', 'par', 'yards', 'handicap']; |
|
5 | + protected $fillable = ['course_id', 'number', 'par', 'yards', 'handicap']; |
|
6 | 6 | |
7 | - public function course() |
|
8 | - { |
|
9 | - return $this->belongsTo('Course'); |
|
10 | - } |
|
7 | + public function course() |
|
8 | + { |
|
9 | + return $this->belongsTo('Course'); |
|
10 | + } |
|
11 | 11 | |
12 | 12 | public function holescores() |
13 | - { |
|
14 | - return $this->hasMany('Holescore'); |
|
15 | - } |
|
13 | + { |
|
14 | + return $this->hasMany('Holescore'); |
|
15 | + } |
|
16 | 16 | |
17 | 17 | public function courses() |
18 | - { |
|
19 | - return $this->hasManyThrough('Course','Holescore'); |
|
20 | - } |
|
18 | + { |
|
19 | + return $this->hasManyThrough('Course','Holescore'); |
|
20 | + } |
|
21 | 21 | } |
@@ -1,7 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class Hole extends Eloquent |
|
4 | -{ |
|
3 | +class Hole extends Eloquent { |
|
5 | 4 | protected $fillable = ['course_id', 'number', 'par', 'yards', 'handicap']; |
6 | 5 | |
7 | 6 | public function course() |
@@ -10,12 +9,12 @@ discard block |
||
10 | 9 | } |
11 | 10 | |
12 | 11 | public function holescores() |
13 | - { |
|
12 | + { |
|
14 | 13 | return $this->hasMany('Holescore'); |
15 | 14 | } |
16 | 15 | |
17 | 16 | public function courses() |
18 | - { |
|
17 | + { |
|
19 | 18 | return $this->hasManyThrough('Course','Holescore'); |
20 | 19 | } |
21 | 20 | } |
@@ -2,13 +2,13 @@ |
||
2 | 2 | |
3 | 3 | class Single extends Eloquent |
4 | 4 | { |
5 | - public function match() |
|
6 | - { |
|
7 | - return $this->belongsTo('Match'); |
|
8 | - } |
|
5 | + public function match() |
|
6 | + { |
|
7 | + return $this->belongsTo('Match'); |
|
8 | + } |
|
9 | 9 | |
10 | 10 | public function players() |
11 | - { |
|
12 | - return $this->hasMany('Player'); |
|
13 | - } |
|
11 | + { |
|
12 | + return $this->hasMany('Player'); |
|
13 | + } |
|
14 | 14 | } |
15 | 15 | \ No newline at end of file |
@@ -1,14 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class Single extends Eloquent |
|
4 | -{ |
|
3 | +class Single extends Eloquent { |
|
5 | 4 | public function match() |
6 | 5 | { |
7 | 6 | return $this->belongsTo('Match'); |
8 | 7 | } |
9 | 8 | |
10 | 9 | public function players() |
11 | - { |
|
10 | + { |
|
12 | 11 | return $this->hasMany('Player'); |
13 | 12 | } |
14 | 13 | } |
15 | 14 | \ No newline at end of file |