Passed
Push — master ( 5d0f2f...49b4e9 )
by Darko
10:54
created
app/Http/Controllers/Admin/AdminPromotionController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -187,12 +187,12 @@
 block discarded – undo
187 187
         }
188 188
 
189 189
         // Get all promotions with their statistics
190
-        $promotions = RolePromotion::withCount(['statistics' => function ($query) use ($startDate, $endDate) {
190
+        $promotions = RolePromotion::withCount(['statistics' => function($query) use ($startDate, $endDate) {
191 191
             if ($startDate) {
192 192
                 $query->whereBetween('applied_at', [$startDate, $endDate]);
193 193
             }
194 194
         }])
195
-            ->with(['statistics' => function ($query) use ($startDate, $endDate) {
195
+            ->with(['statistics' => function($query) use ($startDate, $endDate) {
196 196
                 if ($startDate) {
197 197
                     $query->whereBetween('applied_at', [$startDate, $endDate]);
198 198
                 }
Please login to merge, or discard this patch.
app/Models/RolePromotionStat.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
         return [
125 125
             'total_promotions_received' => $stats->count(),
126 126
             'total_days_added' => $stats->sum('days_added'),
127
-            'promotions' => $stats->groupBy('role_promotion_id')->map(function ($group) {
127
+            'promotions' => $stats->groupBy('role_promotion_id')->map(function($group) {
128 128
                 return [
129 129
                     'promotion_id' => $group->first()->role_promotion_id,
130 130
                     'promotion_name' => $group->first()->promotion?->name,
Please login to merge, or discard this patch.
app/Models/RolePromotion.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $now = Carbon::now();
71 71
         return $query->where('is_active', true)
72
-            ->where(function ($q) use ($now) {
72
+            ->where(function($q) use ($now) {
73 73
                 $q->whereNull('end_date')
74 74
                     ->orWhere('end_date', '>=', $now);
75 75
             })
76
-            ->where(function ($q) use ($now) {
76
+            ->where(function($q) use ($now) {
77 77
                 $q->whereNull('start_date')
78 78
                     ->orWhere('start_date', '<=', $now);
79 79
             });
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
         $query = static::where('is_active', true);
119 119
 
120 120
         $now = Carbon::now();
121
-        $query->where(function ($q) use ($now) {
121
+        $query->where(function($q) use ($now) {
122 122
             $q->whereNull('start_date')
123 123
                 ->orWhere('start_date', '<=', $now);
124 124
         });
125 125
 
126
-        $query->where(function ($q) use ($now) {
126
+        $query->where(function($q) use ($now) {
127 127
             $q->whereNull('end_date')
128 128
                 ->orWhere('end_date', '>=', $now);
129 129
         });
130 130
 
131 131
         if ($roleId !== null) {
132
-            $query->where(function ($q) use ($roleId) {
132
+            $query->where(function($q) use ($roleId) {
133 133
                 // If applicable_roles is empty, applies to all custom roles
134 134
                 $q->whereJsonLength('applicable_roles', 0)
135 135
                     ->orWhereJsonContains('applicable_roles', $roleId);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             ->with('role')
210 210
             ->get()
211 211
             ->groupBy('role_id')
212
-            ->map(function ($stats, $roleId) {
212
+            ->map(function($stats, $roleId) {
213 213
                 return [
214 214
                     'role_id' => $roleId,
215 215
                     'role_name' => $stats->first()->role?->name,
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     {
270 270
         $res = self::query()->withTrashed()->where('email', '<>', '[email protected]');
271 271
 
272
-        if (! empty($role)) {
272
+        if (!empty($role)) {
273 273
             $res->where('roles_id', $role);
274 274
         }
275 275
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
             'rate_limit' => $rateLimit ? $rateLimit['rate_limit'] : 60,
319 319
         ];
320 320
 
321
-        if (! empty($email)) {
321
+        if (!empty($email)) {
322 322
             $email = trim($email);
323 323
             $sql += ['email' => $email];
324 324
         }
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
         return self::fromQuery(
428 428
             sprintf(
429 429
                 $query,
430
-                ! empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
431
-                ! empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
432
-                ! empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
433
-                (! empty($role) ? ('AND users.roles_id = '.$role) : ''),
434
-                ! empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '',
435
-                ! empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '',
430
+                !empty($userName) ? 'AND users.username '.'LIKE '.escapeString('%'.$userName.'%') : '',
431
+                !empty($email) ? 'AND users.email '.'LIKE '.escapeString('%'.$email.'%') : '',
432
+                !empty($host) ? 'AND users.host '.'LIKE '.escapeString('%'.$host.'%') : '',
433
+                (!empty($role) ? ('AND users.roles_id = '.$role) : ''),
434
+                !empty($createdFrom) ? 'AND users.created_at >= '.escapeString($createdFrom.' 00:00:00') : '',
435
+                !empty($createdTo) ? 'AND users.created_at <= '.escapeString($createdTo.' 23:59:59') : '',
436 436
                 $order[0],
437 437
                 $order[1],
438 438
                 ($start === false ? '' : ('LIMIT '.$offset.' OFFSET '.$start))
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
     public static function isValidUrl($url): bool
546 546
     {
547
-        return (! preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
547
+        return (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $url)) ? false : true;
548 548
     }
549 549
 
550 550
     /**
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 
581 581
         // Make sure this is the last check, as if a further validation check failed, the invite would still have been used up.
582 582
         $invitedBy = 0;
583
-        if (! $forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
583
+        if (!$forceInviteMode && (int) Settings::settingValue('registerstatus') === Settings::REGISTER_STATUS_INVITE) {
584 584
             if ($inviteCode === '') {
585 585
                 return self::ERR_SIGNUP_BADINVITECODE;
586 586
             }
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
     public static function checkAndUseInvite(string $inviteCode): int
601 601
     {
602 602
         $invite = Invitation::findValidByToken($inviteCode);
603
-        if (! $invite) {
603
+        if (!$invite) {
604 604
             return -1;
605 605
         }
606 606
 
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
     public static function add(string $userName, string $password, string $email, int $role, ?string $notes = '', string $host = '', int $invites = Invitation::DEFAULT_INVITES, int $invitedBy = 0)
617 617
     {
618 618
         $password = self::hashPassword($password);
619
-        if (! $password) {
619
+        if (!$password) {
620 620
             return false;
621 621
         }
622 622
 
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 
659 659
         $cats = ['view console', 'view movies', 'view audio', 'view tv', 'view pc', 'view adult', 'view books', 'view other'];
660 660
 
661
-        if (! empty($allowed)) {
661
+        if (!empty($allowed)) {
662 662
             foreach ($cats as $cat) {
663
-                if (! \in_array($cat, $allowed, false)) {
663
+                if (!\in_array($cat, $allowed, false)) {
664 664
                     $ret[] = match ($cat) {
665 665
                         'view console' => 1000,
666 666
                         'view movies' => 2000,
Please login to merge, or discard this patch.