@@ -204,7 +204,7 @@ |
||
| 204 | 204 | if (!$hasProtocol && !$isDomain) { |
| 205 | 205 | // Ensure internal URL starts with / |
| 206 | 206 | if ($url !== '/' && !str_starts_with($url, '/')) { |
| 207 | - $data['url'] = '/' . $url; |
|
| 207 | + $data['url'] = '/'.$url; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // Ensure internal URL ends with / |
@@ -31,8 +31,8 @@ |
||
| 31 | 31 | ]; |
| 32 | 32 | |
| 33 | 33 | // Email views expect $site to be the string provided by the mailable |
| 34 | - if (! $isEmailView) { |
|
| 35 | - $viewData['site'] = $siteArray; // Now it's a proper array, not a Settings model |
|
| 34 | + if (!$isEmailView) { |
|
| 35 | + $viewData['site'] = $siteArray; // Now it's a proper array, not a Settings model |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Load useful links for sidebar |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function validate(string $attribute, mixed $value, Closure $fail): void |
| 89 | 89 | { |
| 90 | - if (empty($value) || ! is_string($value)) { |
|
| 90 | + if (empty($value) || !is_string($value)) { |
|
| 91 | 91 | $fail('The :attribute must be a valid email address.'); |
| 92 | 92 | return; |
| 93 | 93 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // Check 1: Use the disposable email package |
| 118 | - if (! DisposableDomains::isNotDisposable($value)) { |
|
| 118 | + if (!DisposableDomains::isNotDisposable($value)) { |
|
| 119 | 119 | Log::warning('Disposable email attempt blocked (package detection)', [ |
| 120 | 120 | 'email' => $value, |
| 121 | 121 | 'domain' => $domain, |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // Check 4: Validate domain has valid DNS records (MX or A record) |
| 151 | - if (! $this->validateDnsRecords($domain)) { |
|
| 151 | + if (!$this->validateDnsRecords($domain)) { |
|
| 152 | 152 | Log::warning('Email domain has no valid DNS records', [ |
| 153 | 153 | 'email' => $value, |
| 154 | 154 | 'domain' => $domain, |
@@ -187,12 +187,12 @@ |
||
| 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 | } |
@@ -124,7 +124,7 @@ |
||
| 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, |
@@ -69,11 +69,11 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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, |
@@ -257,13 +257,13 @@ |
||
| 257 | 257 | UserRoleHistory::recordRoleChange( |
| 258 | 258 | userId: $user->id, |
| 259 | 259 | oldRoleId: $oldRole ? $oldRole->id : null, |
| 260 | - newRoleId: $pendingRole ? $pendingRole->id : $user->roles_id, |
|
| 261 | - oldExpiryDate: null, |
|
| 262 | - newExpiryDate: null, |
|
| 263 | - effectiveDate: $now, |
|
| 264 | - isStacked: true, |
|
| 265 | - changeReason: 'manual_activation', |
|
| 266 | - changedBy: null |
|
| 260 | + newRoleId : $pendingRole ? $pendingRole->id : $user->roles_id, |
|
| 261 | + oldExpiryDate : null, |
|
| 262 | + newExpiryDate : null, |
|
| 263 | + effectiveDate : $now, |
|
| 264 | + isStacked : true, |
|
| 265 | + changeReason : 'manual_activation', |
|
| 266 | + changedBy : null |
|
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | 269 | $this->info(sprintf( |
@@ -32,28 +32,28 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | if ($request->has('username') && !empty($request->input('username'))) { |
| 35 | - $query->whereHas('user', function ($q) use ($request) { |
|
| 36 | - $q->where('username', 'like', '%' . $request->input('username') . '%'); |
|
| 35 | + $query->whereHas('user', function($q) use ($request) { |
|
| 36 | + $q->where('username', 'like', '%'.$request->input('username').'%'); |
|
| 37 | 37 | }); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if ($request->has('role_id') && !empty($request->input('role_id'))) { |
| 41 | - $query->where(function ($q) use ($request) { |
|
| 41 | + $query->where(function($q) use ($request) { |
|
| 42 | 42 | $q->where('old_role_id', $request->input('role_id')) |
| 43 | 43 | ->orWhere('new_role_id', $request->input('role_id')); |
| 44 | 44 | }); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if ($request->has('change_reason') && !empty($request->input('change_reason'))) { |
| 48 | - $query->where('change_reason', 'like', '%' . $request->input('change_reason') . '%'); |
|
| 48 | + $query->where('change_reason', 'like', '%'.$request->input('change_reason').'%'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if ($request->has('date_from') && !empty($request->input('date_from'))) { |
| 52 | - $query->where('created_at', '>=', $request->input('date_from') . ' 00:00:00'); |
|
| 52 | + $query->where('created_at', '>=', $request->input('date_from').' 00:00:00'); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ($request->has('date_to') && !empty($request->input('date_to'))) { |
| 56 | - $query->where('created_at', '<=', $request->input('date_to') . ' 23:59:59'); |
|
| 56 | + $query->where('created_at', '<=', $request->input('date_to').' 23:59:59'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Pagination |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->setAdminPrefs(); |
| 89 | 89 | |
| 90 | 90 | $user = User::findOrFail($userId); |
| 91 | - $meta_title = $title = 'Role History for ' . $user->username; |
|
| 91 | + $meta_title = $title = 'Role History for '.$user->username; |
|
| 92 | 92 | |
| 93 | 93 | $history = UserRoleHistory::with(['oldRole', 'newRole', 'changedByUser']) |
| 94 | 94 | ->where('user_id', $userId) |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | // Add country data to each user based on their host IP |
| 63 | 63 | foreach ($results as $user) { |
| 64 | 64 | $position = null; |
| 65 | - if (! empty($user->host) && filter_var($user->host, FILTER_VALIDATE_IP)) { |
|
| 65 | + if (!empty($user->host) && filter_var($user->host, FILTER_VALIDATE_IP)) { |
|
| 66 | 66 | $position = Location::get($user->host); |
| 67 | 67 | } |
| 68 | 68 | $user->country_name = $position ? $position->countryName : null; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $adminManuallySetExpiry = false; |
| 186 | 186 | if ($request->has('rolechangedate')) { |
| 187 | 187 | $roleChangeDate = $request->input('rolechangedate'); |
| 188 | - if (! empty($roleChangeDate)) { |
|
| 188 | + if (!empty($roleChangeDate)) { |
|
| 189 | 189 | User::updateUserRoleChangeDate($editedUser->id, $roleChangeDate); |
| 190 | 190 | $adminManuallySetExpiry = true; // Flag that admin set custom expiry |
| 191 | 191 | } else { |