Completed
Push — master ( d565f6...12549b )
by Michael
02:45
created
app/library/Storage/EloquentRepositories/EloquentSkinRepository.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@
 block discarded – undo
4 4
 
5 5
 class EloquentHoleScoreRepository implements SkinRepository
6 6
 {
7
-        public function all(){}
8
-        public function find($id){}
9
-        public function findByPlayer($playerId){}
10
-        public function findByMatch($matchId){}
11
-        public function create($input){}
12
-        public function update($round){}
7
+		public function all(){}
8
+		public function find($id){}
9
+		public function findByPlayer($playerId){}
10
+		public function findByMatch($matchId){}
11
+		public function create($input){}
12
+		public function update($round){}
13 13
 
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@
 block discarded – undo
4 4
 
5 5
 class EloquentHoleScoreRepository implements SkinRepository
6 6
 {
7
-        public function all(){}
8
-        public function find($id){}
9
-        public function findByPlayer($playerId){}
10
-        public function findByMatch($matchId){}
11
-        public function create($input){}
12
-        public function update($round){}
7
+        public function all() {}
8
+        public function find($id) {}
9
+        public function findByPlayer($playerId) {}
10
+        public function findByMatch($matchId) {}
11
+        public function create($input) {}
12
+        public function update($round) {}
13 13
 
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,13 +2,24 @@
 block discarded – undo
2 2
 
3 3
 use \Skin as Skin;
4 4
 
5
-class EloquentHoleScoreRepository implements SkinRepository
6
-{
7
-        public function all(){}
8
-        public function find($id){}
9
-        public function findByPlayer($playerId){}
10
-        public function findByMatch($matchId){}
11
-        public function create($input){}
12
-        public function update($round){}
5
+class EloquentHoleScoreRepository implements SkinRepository {
6
+        public function all()
7
+        {
8
+}
9
+        public function find($id)
10
+        {
11
+}
12
+        public function findByPlayer($playerId)
13
+        {
14
+}
15
+        public function findByMatch($matchId)
16
+        {
17
+}
18
+        public function create($input)
19
+        {
20
+}
21
+        public function update($round)
22
+        {
23
+}
13 24
 
14 25
 }
15 26
\ No newline at end of file
Please login to merge, or discard this patch.
app/library/Storage/EloquentRepositories/EloquentHoleScoreRepository.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,25 +13,25 @@
 block discarded – undo
13 13
    * Multideminsional Array of Hole Numbers and scores
14 14
    **/
15 15
 	public function __construct(Holescore $holescore)
16
-    {
17
-        $this->holescore = $holescore;
18
-    }
16
+	{
17
+		$this->holescore = $holescore;
18
+	}
19 19
 
20
-    public function all()
21
-    {
22
-        return $this->holescore->all();
23
-    }
20
+	public function all()
21
+	{
22
+		return $this->holescore->all();
23
+	}
24 24
 
25 25
 
26
-    public function find($id)
27
-    {
28
-        return Holescore::find($id);
29
-    }
26
+	public function find($id)
27
+	{
28
+		return Holescore::find($id);
29
+	}
30 30
 
31
-    public function create($input)
32
-    {
33
-        $this->holescore->create($input);
34
-    }
31
+	public function create($input)
32
+	{
33
+		$this->holescore->create($input);
34
+	}
35 35
 
36 36
 	public function update($id, $score)
37 37
 	{
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 use \Holescore as Holescore;
4 4
 use \Player as Player;
5 5
 
6
-class EloquentHoleScoreRepository implements HoleScoreRepository
7
-{
6
+class EloquentHoleScoreRepository implements HoleScoreRepository {
8 7
   /*Return Score collections that include:
9 8
    * Player Name
10 9
    * Date
@@ -13,7 +12,7 @@  discard block
 block discarded – undo
13 12
    * Multideminsional Array of Hole Numbers and scores
14 13
    **/
15 14
 	public function __construct(Holescore $holescore)
16
-    {
15
+	{
17 16
         $this->holescore = $holescore;
18 17
     }
19 18
 
Please login to merge, or discard this patch.
app/library/Storage/EloquentRepositories/EloquentLeaderboardRepository.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 {
7 7
 
8 8
 	public function __construct(Match $match)
9
-    {
10
-        $this->match = $match;
11
-    }
9
+	{
10
+		$this->match = $match;
11
+	}
12 12
 
13
-    public function get($year)
14
-    {
15
-        //Get all match ids for a given year
13
+	public function get($year)
14
+	{
15
+		//Get all match ids for a given year
16 16
 		//get all player ids
17 17
 		//for each player id get total winnings from pivot where (player id and match id)
18 18
 		$year = $year . '-01-01';
@@ -45,5 +45,5 @@  discard block
 block discarded – undo
45 45
 		}
46 46
 
47 47
 		return $moneyList;
48
-    }
48
+	}
49 49
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
         //Get all match ids for a given year
16 16
 		//get all player ids
17 17
 		//for each player id get total winnings from pivot where (player id and match id)
18
-		$year = $year . '-01-01';
18
+		$year = $year.'-01-01';
19 19
 		$matches = $this->match->with('players')->where('created_at', '>', $year)->get(); //get match eventually by year
20 20
 
21 21
 		//filter out players from match
22 22
 		$moneyList = array();
23 23
 		$players = array();
24
-		foreach($matches as $key => $item){
24
+		foreach ($matches as $key => $item) {
25 25
 			$players = $item->players;
26
-			foreach($players as $playersKey => $player){
26
+			foreach ($players as $playersKey => $player) {
27 27
 				if (array_key_exists($player->id, $moneyList)) {
28 28
 					//add previois to new
29 29
 					$moneyList[$player->id]['winnings'] = sprintf('%01.2f', ($moneyList[$player->id]['winnings'] + $player->pivot->winnings));
30 30
 					$moneyList[$player->id]['entryfees'] += 5;
31
-					$moneyList[$player->id]['entryfees'] = sprintf('%01.2f',$moneyList[$player->id]['entryfees']);
31
+					$moneyList[$player->id]['entryfees'] = sprintf('%01.2f', $moneyList[$player->id]['entryfees']);
32 32
 					$moneyList[$player->id]['net'] = $moneyList[$player->id]['winnings'] - $moneyList[$player->id]['entryfees'];
33
-					$moneyList[$player->id]['net'] = sprintf('%01.2f',$moneyList[$player->id]['net']);
33
+					$moneyList[$player->id]['net'] = sprintf('%01.2f', $moneyList[$player->id]['net']);
34 34
 				}
35 35
 				else {
36 36
 					$moneyList[$player->id]['id'] = $player->id;
37 37
 					$moneyList[$player->id]['name'] = $player->name;
38
-					$moneyList[$player->id]['winnings'] = sprintf('%01.2f',$player->pivot->winnings);
38
+					$moneyList[$player->id]['winnings'] = sprintf('%01.2f', $player->pivot->winnings);
39 39
 					$moneyList[$player->id]['entryfees'] = 5;
40
-					$moneyList[$player->id]['entryfees'] = sprintf('%01.2f',$moneyList[$player->id]['entryfees']);
40
+					$moneyList[$player->id]['entryfees'] = sprintf('%01.2f', $moneyList[$player->id]['entryfees']);
41 41
 					$moneyList[$player->id]['net'] = $moneyList[$player->id]['winnings'] - $moneyList[$player->id]['entryfees'];
42
-					$moneyList[$player->id]['net'] = sprintf('%01.2f',$moneyList[$player->id]['net']);
42
+					$moneyList[$player->id]['net'] = sprintf('%01.2f', $moneyList[$player->id]['net']);
43 43
 				}
44 44
 			}
45 45
 		}
Please login to merge, or discard this patch.
Braces   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,11 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 use \Match as Match;
4 4
 
5
-class EloquentLeaderboardRepository implements LeaderboardRepository
6
-{
5
+class EloquentLeaderboardRepository implements LeaderboardRepository {
7 6
 
8 7
 	public function __construct(Match $match)
9
-    {
8
+	{
10 9
         $this->match = $match;
11 10
     }
12 11
 
@@ -21,9 +20,9 @@  discard block
 block discarded – undo
21 20
 		//filter out players from match
22 21
 		$moneyList = array();
23 22
 		$players = array();
24
-		foreach($matches as $key => $item){
23
+		foreach($matches as $key => $item) {
25 24
 			$players = $item->players;
26
-			foreach($players as $playersKey => $player){
25
+			foreach($players as $playersKey => $player) {
27 26
 				if (array_key_exists($player->id, $moneyList)) {
28 27
 					//add previois to new
29 28
 					$moneyList[$player->id]['winnings'] = sprintf('%01.2f', ($moneyList[$player->id]['winnings'] + $player->pivot->winnings));
@@ -31,8 +30,7 @@  discard block
 block discarded – undo
31 30
 					$moneyList[$player->id]['entryfees'] = sprintf('%01.2f',$moneyList[$player->id]['entryfees']);
32 31
 					$moneyList[$player->id]['net'] = $moneyList[$player->id]['winnings'] - $moneyList[$player->id]['entryfees'];
33 32
 					$moneyList[$player->id]['net'] = sprintf('%01.2f',$moneyList[$player->id]['net']);
34
-				}
35
-				else {
33
+				} else {
36 34
 					$moneyList[$player->id]['id'] = $player->id;
37 35
 					$moneyList[$player->id]['name'] = $player->name;
38 36
 					$moneyList[$player->id]['winnings'] = sprintf('%01.2f',$player->pivot->winnings);
Please login to merge, or discard this patch.
app/library/Storage/EloquentRepositories/EloquentPlayerRepository.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,26 +12,26 @@
 block discarded – undo
12 12
    * Multideminsional Array of Hole Numbers and scores   *
13 13
    **/
14 14
 	public function __construct(Player $player)
15
-    {
15
+	{
16 16
 		$this->player = $player;
17
-    }
17
+	}
18 18
 
19
-    public function all()
20
-    {
21
-        return $this->player->orderBy('handicap','asc')->get();
22
-    }
19
+	public function all()
20
+	{
21
+		return $this->player->orderBy('handicap','asc')->get();
22
+	}
23 23
 
24
-    //Find Player by Player Id
25
-    public function find($playerId)
26
-    {
27
-        return $this->player->find($playerId);
28
-    }
24
+	//Find Player by Player Id
25
+	public function find($playerId)
26
+	{
27
+		return $this->player->find($playerId);
28
+	}
29 29
 
30
-    public function create($name, $handicap)
31
-    {
30
+	public function create($name, $handicap)
31
+	{
32 32
 		$this->player->name = $name;
33 33
 		$this->player->handicap = $handicap;
34 34
 		$this->player->save();
35
-    }
35
+	}
36 36
 
37 37
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 
19 19
     public function all()
20 20
     {
21
-        return $this->player->orderBy('handicap','asc')->get();
21
+        return $this->player->orderBy('handicap', 'asc')->get();
22 22
     }
23 23
 
24 24
     //Find Player by Player Id
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use \Player as Player;
4 4
 
5
-class EloquentPlayerRepository implements PlayerRepository
6
-{
5
+class EloquentPlayerRepository implements PlayerRepository {
7 6
   /*Return Score collections that include:
8 7
    * Player Name
9 8
    * Date
@@ -12,7 +11,7 @@  discard block
 block discarded – undo
12 11
    * Multideminsional Array of Hole Numbers and scores   *
13 12
    **/
14 13
 	public function __construct(Player $player)
15
-    {
14
+	{
16 15
 		$this->player = $player;
17 16
     }
18 17
 
Please login to merge, or discard this patch.
app/library/Storage/StorageServiceProvider.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@
 block discarded – undo
3 3
 use Illuminate\Support\ServiceProvider;
4 4
 
5 5
 
6
-class StorageServiceProvider extends ServiceProvider
7
-{
6
+class StorageServiceProvider extends ServiceProvider {
8 7
 
9 8
     public function register()
10 9
     {
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -6,47 +6,47 @@
 block discarded – undo
6 6
 class StorageServiceProvider extends ServiceProvider
7 7
 {
8 8
 
9
-    public function register()
10
-    {
11
-        $this->app->bind(
12
-          'GolfLeague\Storage\Round\RoundRepository',
13
-          'GolfLeague\Storage\Round\EloquentRoundRepository'
14
-        );
15
-		$this->app->bind(
16
-          'GolfLeague\Storage\Match\MatchRepository',
17
-          'GolfLeague\Storage\Match\EloquentMatchRepository'
18
-        );
19
-		$this->app->bind(
20
-          'GolfLeague\Storage\MatchRound\MatchRoundRepository',
21
-          'GolfLeague\Storage\MatchRound\EloquentMatchRoundRepository'
22
-        );
23
-		$this->app->bind(
24
-          'GolfLeague\Storage\Player\PlayerRepository',
25
-          'GolfLeague\Storage\Player\EloquentPlayerRepository'
26
-        );
27
-		$this->app->bind(
28
-          'GolfLeague\Storage\HoleScore\HoleScoreRepository',
29
-          'GolfLeague\Storage\HoleScore\EloquentHoleScoreRepository'
30
-        );
31
-		$this->app->bind(
32
-          'GolfLeague\Storage\Leaderboard\LeaderboardRepository',
33
-          'GolfLeague\Storage\Leaderboard\EloquentLeaderboardRepository'
34
-        );
35
-		$this->app->bind(
36
-          'GolfLeague\Storage\Skin\SkinRepository',
37
-          'GolfLeague\Storage\Skin\EloquentSkinRepository'
38
-        );
39
-		$this->app->bind(
40
-          'GolfLeague\Storage\Ctp\CtpRepository',
41
-          'GolfLeague\Storage\Ctp\EloquentCtpRepository'
42
-        );
43
-        $this->app->bind(
44
-            'GolfLeague\Storage\Team\TeamRepository',
45
-            'GolfLeague\Storage\Team\EloquentTeamRepository'
46
-        );
47
-        $this->app->bind(
48
-            'GolfLeague\Storage\Team\TeamMatchesRepository',
49
-            'GolfLeague\Storage\Team\EloquentTeamMatchesRepository'
50
-        );
51
-    }
9
+	public function register()
10
+	{
11
+		$this->app->bind(
12
+		  'GolfLeague\Storage\Round\RoundRepository',
13
+		  'GolfLeague\Storage\Round\EloquentRoundRepository'
14
+		);
15
+		$this->app->bind(
16
+		  'GolfLeague\Storage\Match\MatchRepository',
17
+		  'GolfLeague\Storage\Match\EloquentMatchRepository'
18
+		);
19
+		$this->app->bind(
20
+		  'GolfLeague\Storage\MatchRound\MatchRoundRepository',
21
+		  'GolfLeague\Storage\MatchRound\EloquentMatchRoundRepository'
22
+		);
23
+		$this->app->bind(
24
+		  'GolfLeague\Storage\Player\PlayerRepository',
25
+		  'GolfLeague\Storage\Player\EloquentPlayerRepository'
26
+		);
27
+		$this->app->bind(
28
+		  'GolfLeague\Storage\HoleScore\HoleScoreRepository',
29
+		  'GolfLeague\Storage\HoleScore\EloquentHoleScoreRepository'
30
+		);
31
+		$this->app->bind(
32
+		  'GolfLeague\Storage\Leaderboard\LeaderboardRepository',
33
+		  'GolfLeague\Storage\Leaderboard\EloquentLeaderboardRepository'
34
+		);
35
+		$this->app->bind(
36
+		  'GolfLeague\Storage\Skin\SkinRepository',
37
+		  'GolfLeague\Storage\Skin\EloquentSkinRepository'
38
+		);
39
+		$this->app->bind(
40
+		  'GolfLeague\Storage\Ctp\CtpRepository',
41
+		  'GolfLeague\Storage\Ctp\EloquentCtpRepository'
42
+		);
43
+		$this->app->bind(
44
+			'GolfLeague\Storage\Team\TeamRepository',
45
+			'GolfLeague\Storage\Team\EloquentTeamRepository'
46
+		);
47
+		$this->app->bind(
48
+			'GolfLeague\Storage\Team\TeamMatchesRepository',
49
+			'GolfLeague\Storage\Team\EloquentTeamMatchesRepository'
50
+		);
51
+	}
52 52
 }
Please login to merge, or discard this patch.
app/library/Storage/SkinRepository.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,11 +4,11 @@
 block discarded – undo
4 4
 
5 5
 interface SkinRepository {
6 6
 
7
-    public function all();
8
-    public function find($id);
9
-    public function findByPlayer($playerId);
10
-    public function findByMatch($matchId);
11
-    public function create($input);
12
-    public function update($round);
7
+	public function all();
8
+	public function find($id);
9
+	public function findByPlayer($playerId);
10
+	public function findByMatch($matchId);
11
+	public function create($input);
12
+	public function update($round);
13 13
 
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
app/library/Storage/EloquentRepositories/EloquentMatchRepository.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 
37 37
 	public function getYears()
38 38
 	{
39
-		$dates =  Match::orderBy('date', 'DESC')->get(['date']);
39
+		$dates = Match::orderBy('date', 'DESC')->get(['date']);
40 40
 		//return $dates;
41
-		$years = $dates->map(function($years){
41
+		$years = $dates->map(function($years) {
42 42
 			return substr($years->date, 0, 4);
43 43
 		})->toArray();
44 44
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 		$this->match->save(); //save to match table
65 65
 
66
-		foreach ($matchdata['player'] as $key => $player){
66
+		foreach ($matchdata['player'] as $key => $player) {
67 67
 			$currentPlayer = $this->player->find($player['player_id']);
68 68
 			$attributes = array(
69 69
 				"level_id" => $player['level_id'],
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
    * Multideminsional Array of Hole Numbers and scores   *
15 15
    **/
16 16
 	public function __construct(Match $match, Player $player)
17
-    {
18
-        $this->match = $match;
17
+	{
18
+		$this->match = $match;
19 19
 		$this->player = $player;
20
-    }
20
+	}
21 21
 
22
-    public function all()
23
-    {
22
+	public function all()
23
+	{
24 24
 		return Match::orderBy('date', 'DESC')->get();
25
-    }
25
+	}
26 26
 
27 27
 	public function get($matchid)
28 28
 	{
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 
58 58
 		return array_unique($years);
59 59
 	}
60
-    //Find Scores by Player Id
61
-    public function find($playerId)
62
-    {
63
-        //return Round::with('player', 'holescores')->where('player_id', '=', $playerId)->get();
64
-    }
65
-
66
-    public function create($matchdata)
67
-    {
60
+	//Find Scores by Player Id
61
+	public function find($playerId)
62
+	{
63
+		//return Round::with('player', 'holescores')->where('player_id', '=', $playerId)->get();
64
+	}
65
+
66
+	public function create($matchdata)
67
+	{
68 68
 		//enter match data to Matches table
69 69
 		$this->match->date = $matchdata['date'];
70 70
 		$this->match->course_id = $matchdata['course'];
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 			$currentPlayer->matches()->save($this->match, $attributes); //save match_player pivot data
88 88
 		}// End foreach
89 89
 		return $this->match->id;
90
-    }
90
+	}
91 91
 
92 92
 	public function update($matchdata)
93 93
 	{
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 use \Round as Round;
6 6
 use \Player as Player;
7 7
 
8
-class EloquentMatchRepository implements MatchRepository
9
-{
8
+class EloquentMatchRepository implements MatchRepository {
10 9
   /*Return Score collections that include:
11 10
    * Player Name
12 11
    * Date
@@ -15,7 +14,7 @@  discard block
 block discarded – undo
15 14
    * Multideminsional Array of Hole Numbers and scores   *
16 15
    **/
17 16
 	public function __construct(Match $match, Player $player)
18
-    {
17
+	{
19 18
         $this->match = $match;
20 19
 		$this->player = $player;
21 20
     }
@@ -52,7 +51,8 @@  discard block
 block discarded – undo
52 51
 	{
53 52
 		$dates =  Match::orderBy('date', 'DESC')->get(['date']);
54 53
 		//return $dates;
55
-		$years = $dates->map(function($years){
54
+		$years = $dates->map(function($years)
55
+		{
56 56
 			return substr($years->date, 0, 4);
57 57
 		})->toArray();
58 58
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
 		$this->match->save(); //save to match table
79 79
 
80
-		foreach ($matchdata['player'] as $key => $player){
80
+		foreach ($matchdata['player'] as $key => $player) {
81 81
 			$currentPlayer = $this->player->find($player['player_id']);
82 82
 			$attributes = array(
83 83
 				"level_id" => $player['level_id'],
Please login to merge, or discard this patch.
app/controllers/UsersController.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@
 block discarded – undo
188 188
     /**
189 189
      * Log the user out of the application.
190 190
      *
191
-     * @return  Illuminate\Http\Response
191
+     * @return  Illuminate\Http\RedirectResponse
192 192
      */
193 193
     public function logout()
194 194
     {
Please login to merge, or discard this patch.
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -10,190 +10,190 @@
 block discarded – undo
10 10
 class UsersController extends Controller
11 11
 {
12 12
 
13
-    /**
14
-     * Displays the form for account creation
15
-     *
16
-     * @return  Illuminate\Http\Response
17
-     */
18
-    public function create()
19
-    {
20
-        return View::make(Config::get('confide::signup_form'));
21
-    }
22
-
23
-    /**
24
-     * Stores new account
25
-     *
26
-     * @return  Illuminate\Http\Response
27
-     */
28
-    public function store()
29
-    {
30
-        $repo = App::make('UserRepository');
31
-        $user = $repo->signup(Input::all());
32
-
33
-        if ($user->id) {
34
-            if (Config::get('confide::signup_email')) {
35
-                Mail::queueOn(
36
-                    Config::get('confide::email_queue'),
37
-                    Config::get('confide::email_account_confirmation'),
38
-                    compact('user'),
39
-                    function ($message) use ($user) {
40
-                        $message
41
-                            ->to($user->email, $user->username)
42
-                            ->subject(Lang::get('confide::confide.email.account_confirmation.subject'));
43
-                    }
44
-                );
45
-            }
46
-
47
-            return Redirect::action('UsersController@login')
48
-                ->with('notice', Lang::get('confide::confide.alerts.account_created'));
49
-        } else {
50
-            $error = $user->errors()->all(':message');
51
-
52
-            return Redirect::action('UsersController@create')
53
-                ->withInput(Input::except('password'))
54
-                ->with('error', $error);
55
-        }
56
-    }
57
-
58
-    /**
59
-     * Displays the login form
60
-     *
61
-     * @return  Illuminate\Http\Response
62
-     */
63
-    public function login()
64
-    {
65
-        if (Confide::user()) {
66
-            return Redirect::to('/');
67
-        } else {
68
-            return View::make(Config::get('confide::login_form'));
69
-        }
70
-    }
71
-
72
-    /**
73
-     * Attempt to do login
74
-     *
75
-     * @return  Illuminate\Http\Response
76
-     */
77
-    public function doLogin()
78
-    {
79
-        $repo = App::make('UserRepository');
80
-        $input = Input::all();
81
-
82
-        if ($repo->login($input)) {
83
-            return Redirect::intended('/');
84
-        } else {
85
-            if ($repo->isThrottled($input)) {
86
-                $err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
87
-            } elseif ($repo->existsButNotConfirmed($input)) {
88
-                $err_msg = Lang::get('confide::confide.alerts.not_confirmed');
89
-            } else {
90
-                $err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
91
-            }
92
-
93
-            return Redirect::action('UsersController@login')
94
-                ->withInput(Input::except('password'))
95
-                ->with('error', $err_msg);
96
-        }
97
-    }
98
-
99
-    /**
100
-     * Attempt to confirm account with code
101
-     *
102
-     * @param  string $code
103
-     *
104
-     * @return  Illuminate\Http\Response
105
-     */
106
-    public function confirm($code)
107
-    {
108
-        if (Confide::confirm($code)) {
109
-            $notice_msg = Lang::get('confide::confide.alerts.confirmation');
110
-            return Redirect::action('UsersController@login')
111
-                ->with('notice', $notice_msg);
112
-        } else {
113
-            $error_msg = Lang::get('confide::confide.alerts.wrong_confirmation');
114
-            return Redirect::action('UsersController@login')
115
-                ->with('error', $error_msg);
116
-        }
117
-    }
118
-
119
-    /**
120
-     * Displays the forgot password form
121
-     *
122
-     * @return  Illuminate\Http\Response
123
-     */
124
-    public function forgotPassword()
125
-    {
126
-        return View::make(Config::get('confide::forgot_password_form'));
127
-    }
128
-
129
-    /**
130
-     * Attempt to send change password link to the given email
131
-     *
132
-     * @return  Illuminate\Http\Response
133
-     */
134
-    public function doForgotPassword()
135
-    {
136
-        if (Confide::forgotPassword(Input::get('email'))) {
137
-            $notice_msg = Lang::get('confide::confide.alerts.password_forgot');
138
-            return Redirect::action('UsersController@login')
139
-                ->with('notice', $notice_msg);
140
-        } else {
141
-            $error_msg = Lang::get('confide::confide.alerts.wrong_password_forgot');
142
-            return Redirect::action('UsersController@doForgotPassword')
143
-                ->withInput()
144
-                ->with('error', $error_msg);
145
-        }
146
-    }
147
-
148
-    /**
149
-     * Shows the change password form with the given token
150
-     *
151
-     * @param  string $token
152
-     *
153
-     * @return  Illuminate\Http\Response
154
-     */
155
-    public function resetPassword($token)
156
-    {
157
-        return View::make(Config::get('confide::reset_password_form'))
158
-                ->with('token', $token);
159
-    }
160
-
161
-    /**
162
-     * Attempt change password of the user
163
-     *
164
-     * @return  Illuminate\Http\Response
165
-     */
166
-    public function doResetPassword()
167
-    {
168
-        $repo = App::make('UserRepository');
169
-        $input = array(
170
-            'token'                 =>Input::get('token'),
171
-            'password'              =>Input::get('password'),
172
-            'password_confirmation' =>Input::get('password_confirmation'),
173
-        );
174
-
175
-        // By passing an array with the token, password and confirmation
176
-        if ($repo->resetPassword($input)) {
177
-            $notice_msg = Lang::get('confide::confide.alerts.password_reset');
178
-            return Redirect::action('UsersController@login')
179
-                ->with('notice', $notice_msg);
180
-        } else {
181
-            $error_msg = Lang::get('confide::confide.alerts.wrong_password_reset');
182
-            return Redirect::action('UsersController@resetPassword', array('token'=>$input['token']))
183
-                ->withInput()
184
-                ->with('error', $error_msg);
185
-        }
186
-    }
187
-
188
-    /**
189
-     * Log the user out of the application.
190
-     *
191
-     * @return  Illuminate\Http\Response
192
-     */
193
-    public function logout()
194
-    {
195
-        Confide::logout();
196
-
197
-        return Redirect::to('/');
198
-    }
13
+	/**
14
+	 * Displays the form for account creation
15
+	 *
16
+	 * @return  Illuminate\Http\Response
17
+	 */
18
+	public function create()
19
+	{
20
+		return View::make(Config::get('confide::signup_form'));
21
+	}
22
+
23
+	/**
24
+	 * Stores new account
25
+	 *
26
+	 * @return  Illuminate\Http\Response
27
+	 */
28
+	public function store()
29
+	{
30
+		$repo = App::make('UserRepository');
31
+		$user = $repo->signup(Input::all());
32
+
33
+		if ($user->id) {
34
+			if (Config::get('confide::signup_email')) {
35
+				Mail::queueOn(
36
+					Config::get('confide::email_queue'),
37
+					Config::get('confide::email_account_confirmation'),
38
+					compact('user'),
39
+					function ($message) use ($user) {
40
+						$message
41
+							->to($user->email, $user->username)
42
+							->subject(Lang::get('confide::confide.email.account_confirmation.subject'));
43
+					}
44
+				);
45
+			}
46
+
47
+			return Redirect::action('UsersController@login')
48
+				->with('notice', Lang::get('confide::confide.alerts.account_created'));
49
+		} else {
50
+			$error = $user->errors()->all(':message');
51
+
52
+			return Redirect::action('UsersController@create')
53
+				->withInput(Input::except('password'))
54
+				->with('error', $error);
55
+		}
56
+	}
57
+
58
+	/**
59
+	 * Displays the login form
60
+	 *
61
+	 * @return  Illuminate\Http\Response
62
+	 */
63
+	public function login()
64
+	{
65
+		if (Confide::user()) {
66
+			return Redirect::to('/');
67
+		} else {
68
+			return View::make(Config::get('confide::login_form'));
69
+		}
70
+	}
71
+
72
+	/**
73
+	 * Attempt to do login
74
+	 *
75
+	 * @return  Illuminate\Http\Response
76
+	 */
77
+	public function doLogin()
78
+	{
79
+		$repo = App::make('UserRepository');
80
+		$input = Input::all();
81
+
82
+		if ($repo->login($input)) {
83
+			return Redirect::intended('/');
84
+		} else {
85
+			if ($repo->isThrottled($input)) {
86
+				$err_msg = Lang::get('confide::confide.alerts.too_many_attempts');
87
+			} elseif ($repo->existsButNotConfirmed($input)) {
88
+				$err_msg = Lang::get('confide::confide.alerts.not_confirmed');
89
+			} else {
90
+				$err_msg = Lang::get('confide::confide.alerts.wrong_credentials');
91
+			}
92
+
93
+			return Redirect::action('UsersController@login')
94
+				->withInput(Input::except('password'))
95
+				->with('error', $err_msg);
96
+		}
97
+	}
98
+
99
+	/**
100
+	 * Attempt to confirm account with code
101
+	 *
102
+	 * @param  string $code
103
+	 *
104
+	 * @return  Illuminate\Http\Response
105
+	 */
106
+	public function confirm($code)
107
+	{
108
+		if (Confide::confirm($code)) {
109
+			$notice_msg = Lang::get('confide::confide.alerts.confirmation');
110
+			return Redirect::action('UsersController@login')
111
+				->with('notice', $notice_msg);
112
+		} else {
113
+			$error_msg = Lang::get('confide::confide.alerts.wrong_confirmation');
114
+			return Redirect::action('UsersController@login')
115
+				->with('error', $error_msg);
116
+		}
117
+	}
118
+
119
+	/**
120
+	 * Displays the forgot password form
121
+	 *
122
+	 * @return  Illuminate\Http\Response
123
+	 */
124
+	public function forgotPassword()
125
+	{
126
+		return View::make(Config::get('confide::forgot_password_form'));
127
+	}
128
+
129
+	/**
130
+	 * Attempt to send change password link to the given email
131
+	 *
132
+	 * @return  Illuminate\Http\Response
133
+	 */
134
+	public function doForgotPassword()
135
+	{
136
+		if (Confide::forgotPassword(Input::get('email'))) {
137
+			$notice_msg = Lang::get('confide::confide.alerts.password_forgot');
138
+			return Redirect::action('UsersController@login')
139
+				->with('notice', $notice_msg);
140
+		} else {
141
+			$error_msg = Lang::get('confide::confide.alerts.wrong_password_forgot');
142
+			return Redirect::action('UsersController@doForgotPassword')
143
+				->withInput()
144
+				->with('error', $error_msg);
145
+		}
146
+	}
147
+
148
+	/**
149
+	 * Shows the change password form with the given token
150
+	 *
151
+	 * @param  string $token
152
+	 *
153
+	 * @return  Illuminate\Http\Response
154
+	 */
155
+	public function resetPassword($token)
156
+	{
157
+		return View::make(Config::get('confide::reset_password_form'))
158
+				->with('token', $token);
159
+	}
160
+
161
+	/**
162
+	 * Attempt change password of the user
163
+	 *
164
+	 * @return  Illuminate\Http\Response
165
+	 */
166
+	public function doResetPassword()
167
+	{
168
+		$repo = App::make('UserRepository');
169
+		$input = array(
170
+			'token'                 =>Input::get('token'),
171
+			'password'              =>Input::get('password'),
172
+			'password_confirmation' =>Input::get('password_confirmation'),
173
+		);
174
+
175
+		// By passing an array with the token, password and confirmation
176
+		if ($repo->resetPassword($input)) {
177
+			$notice_msg = Lang::get('confide::confide.alerts.password_reset');
178
+			return Redirect::action('UsersController@login')
179
+				->with('notice', $notice_msg);
180
+		} else {
181
+			$error_msg = Lang::get('confide::confide.alerts.wrong_password_reset');
182
+			return Redirect::action('UsersController@resetPassword', array('token'=>$input['token']))
183
+				->withInput()
184
+				->with('error', $error_msg);
185
+		}
186
+	}
187
+
188
+	/**
189
+	 * Log the user out of the application.
190
+	 *
191
+	 * @return  Illuminate\Http\Response
192
+	 */
193
+	public function logout()
194
+	{
195
+		Confide::logout();
196
+
197
+		return Redirect::to('/');
198
+	}
199 199
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
                     Config::get('confide::email_queue'),
37 37
                     Config::get('confide::email_account_confirmation'),
38 38
                     compact('user'),
39
-                    function ($message) use ($user) {
39
+                    function($message) use ($user) {
40 40
                         $message
41 41
                             ->to($user->email, $user->username)
42 42
                             ->subject(Lang::get('confide::confide.email.account_confirmation.subject'));
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
  *
8 8
  * Implements actions regarding user management
9 9
  */
10
-class UsersController extends Controller
11
-{
10
+class UsersController extends Controller {
12 11
 
13 12
     /**
14 13
      * Displays the form for account creation
@@ -36,7 +35,8 @@  discard block
 block discarded – undo
36 35
                     Config::get('confide::email_queue'),
37 36
                     Config::get('confide::email_account_confirmation'),
38 37
                     compact('user'),
39
-                    function ($message) use ($user) {
38
+                    function ($message) use ($user)
39
+                    {
40 40
                         $message
41 41
                             ->to($user->email, $user->username)
42 42
                             ->subject(Lang::get('confide::confide.email.account_confirmation.subject'));
Please login to merge, or discard this patch.
app/models/UserRepository.php 4 patches
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,6 @@  discard block
 block discarded – undo
58 58
      * Checks if the credentials has been throttled by too
59 59
      * much failed login attempts
60 60
      *
61
-     * @param  array $credentials Array containing the credentials (email and password)
62 61
      *
63 62
      * @return  boolean Is throttled
64 63
      */
@@ -71,9 +70,8 @@  discard block
 block discarded – undo
71 70
      * Checks if the given credentials correponds to a user that exists but
72 71
      * is not confirmed
73 72
      *
74
-     * @param  array $credentials Array containing the credentials (email and password)
75 73
      *
76
-     * @return  boolean Exists and is not confirmed?
74
+     * @return  boolean|null Exists and is not confirmed?
77 75
      */
78 76
     public function existsButNotConfirmed($input)
79 77
     {
Please login to merge, or discard this patch.
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -10,120 +10,120 @@
 block discarded – undo
10 10
  */
11 11
 class UserRepository
12 12
 {
13
-    /**
14
-     * Signup a new account with the given parameters
15
-     *
16
-     * @param  array $input Array containing 'email' and 'password'.
17
-     *
18
-     * @return  User User object that may or may not be saved successfully. Check the id to make sure.
19
-     */
20
-    public function signup($input)
21
-    {
22
-        $user = new User;
23
-
24
-        $user->email    = array_get($input, 'email');
25
-        $user->password = array_get($input, 'password');
26
-
27
-        // The password confirmation will be removed from model
28
-        // before saving. This field will be used in Ardent's
29
-        // auto validation.
30
-        $user->password_confirmation = array_get($input, 'password_confirmation');
31
-
32
-        // Generate a random confirmation code
33
-        $user->confirmation_code     = md5(uniqid(mt_rand(), true));
34
-
35
-        // Save if valid. Password field will be hashed before save
36
-        $this->save($user);
37
-
38
-        return $user;
39
-    }
40
-
41
-    /**
42
-     * Attempts to login with the given credentials.
43
-     *
44
-     * @param  array $input Array containing the credentials (email and password)
45
-     *
46
-     * @return  boolean Success?
47
-     */
48
-    public function login($input)
49
-    {
50
-        if (! isset($input['password'])) {
51
-            $input['password'] = null;
52
-        }
53
-
54
-        return Confide::logAttempt($input, Config::get('confide::signup_confirm'));
55
-    }
56
-
57
-    /**
58
-     * Checks if the credentials has been throttled by too
59
-     * much failed login attempts
60
-     *
61
-     * @param  array $credentials Array containing the credentials (email and password)
62
-     *
63
-     * @return  boolean Is throttled
64
-     */
65
-    public function isThrottled($input)
66
-    {
67
-        return Confide::isThrottled($input);
68
-    }
69
-
70
-    /**
71
-     * Checks if the given credentials correponds to a user that exists but
72
-     * is not confirmed
73
-     *
74
-     * @param  array $credentials Array containing the credentials (email and password)
75
-     *
76
-     * @return  boolean Exists and is not confirmed?
77
-     */
78
-    public function existsButNotConfirmed($input)
79
-    {
80
-        $user = Confide::getUserByEmailOrUsername($input);
81
-
82
-        if ($user) {
83
-            $correctPassword = Hash::check(
84
-                isset($input['password']) ? $input['password'] : false,
85
-                $user->password
86
-            );
87
-
88
-            return (! $user->confirmed && $correctPassword);
89
-        }
90
-    }
91
-
92
-    /**
93
-     * Resets a password of a user. The $input['token'] will tell which user.
94
-     *
95
-     * @param  array $input Array containing 'token', 'password' and 'password_confirmation' keys.
96
-     *
97
-     * @return  boolean Success
98
-     */
99
-    public function resetPassword($input)
100
-    {
101
-        $result = false;
102
-        $user   = Confide::userByResetPasswordToken($input['token']);
103
-
104
-        if ($user) {
105
-            $user->password              = $input['password'];
106
-            $user->password_confirmation = $input['password_confirmation'];
107
-            $result = $this->save($user);
108
-        }
109
-
110
-        // If result is positive, destroy token
111
-        if ($result) {
112
-            Confide::destroyForgotPasswordToken($input['token']);
113
-        }
114
-
115
-        return $result;
116
-    }
117
-
118
-    /**
119
-     * Simply saves the given instance
120
-     *
121
-     * @param  User $instance
122
-     *
123
-     * @return  boolean Success
124
-     */
125
-    public function save(User $instance)
126
-    {
127
-        return $instance->save();
128
-    }
13
+	/**
14
+	 * Signup a new account with the given parameters
15
+	 *
16
+	 * @param  array $input Array containing 'email' and 'password'.
17
+	 *
18
+	 * @return  User User object that may or may not be saved successfully. Check the id to make sure.
19
+	 */
20
+	public function signup($input)
21
+	{
22
+		$user = new User;
23
+
24
+		$user->email    = array_get($input, 'email');
25
+		$user->password = array_get($input, 'password');
26
+
27
+		// The password confirmation will be removed from model
28
+		// before saving. This field will be used in Ardent's
29
+		// auto validation.
30
+		$user->password_confirmation = array_get($input, 'password_confirmation');
31
+
32
+		// Generate a random confirmation code
33
+		$user->confirmation_code     = md5(uniqid(mt_rand(), true));
34
+
35
+		// Save if valid. Password field will be hashed before save
36
+		$this->save($user);
37
+
38
+		return $user;
39
+	}
40
+
41
+	/**
42
+	 * Attempts to login with the given credentials.
43
+	 *
44
+	 * @param  array $input Array containing the credentials (email and password)
45
+	 *
46
+	 * @return  boolean Success?
47
+	 */
48
+	public function login($input)
49
+	{
50
+		if (! isset($input['password'])) {
51
+			$input['password'] = null;
52
+		}
53
+
54
+		return Confide::logAttempt($input, Config::get('confide::signup_confirm'));
55
+	}
56
+
57
+	/**
58
+	 * Checks if the credentials has been throttled by too
59
+	 * much failed login attempts
60
+	 *
61
+	 * @param  array $credentials Array containing the credentials (email and password)
62
+	 *
63
+	 * @return  boolean Is throttled
64
+	 */
65
+	public function isThrottled($input)
66
+	{
67
+		return Confide::isThrottled($input);
68
+	}
69
+
70
+	/**
71
+	 * Checks if the given credentials correponds to a user that exists but
72
+	 * is not confirmed
73
+	 *
74
+	 * @param  array $credentials Array containing the credentials (email and password)
75
+	 *
76
+	 * @return  boolean Exists and is not confirmed?
77
+	 */
78
+	public function existsButNotConfirmed($input)
79
+	{
80
+		$user = Confide::getUserByEmailOrUsername($input);
81
+
82
+		if ($user) {
83
+			$correctPassword = Hash::check(
84
+				isset($input['password']) ? $input['password'] : false,
85
+				$user->password
86
+			);
87
+
88
+			return (! $user->confirmed && $correctPassword);
89
+		}
90
+	}
91
+
92
+	/**
93
+	 * Resets a password of a user. The $input['token'] will tell which user.
94
+	 *
95
+	 * @param  array $input Array containing 'token', 'password' and 'password_confirmation' keys.
96
+	 *
97
+	 * @return  boolean Success
98
+	 */
99
+	public function resetPassword($input)
100
+	{
101
+		$result = false;
102
+		$user   = Confide::userByResetPasswordToken($input['token']);
103
+
104
+		if ($user) {
105
+			$user->password              = $input['password'];
106
+			$user->password_confirmation = $input['password_confirmation'];
107
+			$result = $this->save($user);
108
+		}
109
+
110
+		// If result is positive, destroy token
111
+		if ($result) {
112
+			Confide::destroyForgotPasswordToken($input['token']);
113
+		}
114
+
115
+		return $result;
116
+	}
117
+
118
+	/**
119
+	 * Simply saves the given instance
120
+	 *
121
+	 * @param  User $instance
122
+	 *
123
+	 * @return  boolean Success
124
+	 */
125
+	public function save(User $instance)
126
+	{
127
+		return $instance->save();
128
+	}
129 129
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function login($input)
49 49
     {
50
-        if (! isset($input['password'])) {
50
+        if ( ! isset($input['password'])) {
51 51
             $input['password'] = null;
52 52
         }
53 53
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                 $user->password
86 86
             );
87 87
 
88
-            return (! $user->confirmed && $correctPassword);
88
+            return ( ! $user->confirmed && $correctPassword);
89 89
         }
90 90
     }
91 91
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
  * This service abstracts some interactions that occurs between Confide and
9 9
  * the Database.
10 10
  */
11
-class UserRepository
12
-{
11
+class UserRepository {
13 12
     /**
14 13
      * Signup a new account with the given parameters
15 14
      *
Please login to merge, or discard this patch.