Passed
Push — master ( 260ede...8de997 )
by Richard
03:29
created
routes/api.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 use Furic\Leaderboards\Http\Controllers\LeaderboardController;
5 5
 
6 6
 Route::prefix('api')->group(function() {
7
-	Route::get('leaderboards/{id}', [LeaderboardController::class, 'show']);
7
+    Route::get('leaderboards/{id}', [LeaderboardController::class, 'show']);
8 8
     Route::get('leaderboards/{id}/current', [LeaderboardController::class, 'showCurrent']);
9 9
     Route::get('leaderboards/{id}/score-sums', [LeaderboardController::class, 'showScoreSums']);
10 10
     Route::get('leaderboards/{id}/highscores', [LeaderboardController::class, 'showHighscores']);
Please login to merge, or discard this patch.
src/Models/LeaderboardTimescope.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@
 block discarded – undo
37 37
                     break;
38 38
             }
39 39
             $previousLeaderboardTimescope = SELF::where('start_at', '<', $data['start_at'])->orderBy('start_at', 'desc')->first();
40
-            if ($previousLeaderboardTimescope)
41
-                $data['previous_id'] = $previousLeaderboardTimescope->id;
40
+            if ($previousLeaderboardTimescope) {
41
+                            $data['previous_id'] = $previousLeaderboardTimescope->id;
42
+            }
42 43
             $leaderboardTimescope = SELF::create($data);
43 44
         }
44 45
         return $leaderboardTimescope;
Please login to merge, or discard this patch.
src/Models/LeaderboardScore.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
 
30 30
     public function getNameAttribute()
31 31
     {
32
-        if ($this->player != null)
33
-            return $this->player->name;
32
+        if ($this->player != null) {
33
+                    return $this->player->name;
34
+        }
34 35
         return NULL;
35 36
         // return $this->player()->firstOrFail()->name;
36 37
     }
Please login to merge, or discard this patch.
database/seeds/LeaderboardTableSeeder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     {
16 16
         factory(Leaderboard::class, 3)
17 17
             ->create()
18
-            ->each(function (Leaderboard $leaderboard, $index) {
18
+            ->each(function(Leaderboard $leaderboard, $index) {
19 19
                 $leaderboard->game_id = 1;
20 20
                 $leaderboard->timescope = $index; // Create all-time, daily and weekly leaderboards
21 21
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
                 if ($index > 0) {
24 24
                     factory(LeaderboardReward::class, 5)
25 25
                         ->create()
26
-                        ->each(function (LeaderboardReward $leaderboardReward, $index) {
26
+                        ->each(function(LeaderboardReward $leaderboardReward, $index) {
27 27
                             $leaderboardReward->leaderboard_id = $leaderboard->id;
28 28
                             $leaderboardReward->highscore_rank = $index + 1;
29 29
                             $leaderboardReward->amount = (6 - $index) * 100;
Please login to merge, or discard this patch.
src/Http/Controllers/LeaderboardController.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -338,8 +338,9 @@  discard block
 block discarded – undo
338 338
                 }
339 339
             }
340 340
             $playerReward = LeaderboardPlayerReward::where('player_id', $request->player_id)->where('leaderboard_timescope_id', $leaderboardTimescope->id)->whereNotNull('score_sum');
341
-            if (!$playerReward)
342
-                $playerReward = LeaderboardPlayerReward::make(['leaderboard_timescope_id' => $leaderboardTimescope->id, 'player_id' => $request->player_id]);
341
+            if (!$playerReward) {
342
+                            $playerReward = LeaderboardPlayerReward::make(['leaderboard_timescope_id' => $leaderboardTimescope->id, 'player_id' => $request->player_id]);
343
+            }
343 344
             $playerReward->score_sum = $rewardedScoreSum;
344 345
             $playerReward->save();
345 346
         }
@@ -347,8 +348,9 @@  discard block
 block discarded – undo
347 348
         // Rank reward only report to last LeaderboardTimescope
348 349
 
349 350
         // dd ($leaderboardTimescope->previous());
350
-        if ($leaderboardTimescope->previous() != null)
351
-            $leaderboardTimescope = $leaderboardTimescope->previous();
351
+        if ($leaderboardTimescope->previous() != null) {
352
+                    $leaderboardTimescope = $leaderboardTimescope->previous();
353
+        }
352 354
 
353 355
         $playerReward = LeaderboardPlayerReward::firstOrNew(['player_id' => $request->player_id, 'leaderboard_timescope_id' => $leaderboardTimescope->id]);
354 356
         if ($request->has('rank')) {
Please login to merge, or discard this patch.