Test Setup Failed
Branch master (a55231)
by Richard
04:51
created
database/seeds/LeaderboardTableSeeder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     {
15 15
         factory(Leaderboard::class, 5)
16 16
             ->create()
17
-            ->each(function (Leaderboard $leaderboard) {
17
+            ->each(function(Leaderboard $leaderboard) {
18 18
                 $leaderboard->game_id = rand(1, 3);
19 19
             });
20 20
     }
Please login to merge, or discard this patch.
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/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 = $rewardedScore;
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.
src/Models/LeaderboardTimescope.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
     
72 72
     public function getHighscoreRank($highscore)
73 73
     {
74
-        return $this->hasMany(LeaderboardScore::class)->filter(function ($score) {
74
+        return $this->hasMany(LeaderboardScore::class)->filter(function($score) {
75 75
             return $score['highscore'] > $highscore;
76 76
         });
77 77
     }
Please login to merge, or discard this 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.