@@ -101,16 +101,18 @@ |
||
101 | 101 | ]; |
102 | 102 | |
103 | 103 | foreach ($haystacks as $haystack) { |
104 | - if (Str::contains(Str::lower($haystack), $needles)) |
|
105 | - return true; |
|
104 | + if (Str::contains(Str::lower($haystack), $needles)) { |
|
105 | + return true; |
|
106 | + } |
|
106 | 107 | } |
107 | 108 | |
108 | 109 | return false; |
109 | 110 | }); |
110 | 111 | }) |
111 | 112 | ->sortBy(function (Ability $ability) { |
112 | - if ($this->sortField === 'name') |
|
113 | - return $ability->meta('name', ''); |
|
113 | + if ($this->sortField === 'name') { |
|
114 | + return $ability->meta('name', ''); |
|
115 | + } |
|
114 | 116 | |
115 | 117 | // $this->sortField === key or else, do the same sorting |
116 | 118 | return $ability->key(); |
@@ -133,8 +133,9 @@ |
||
133 | 133 | ]; |
134 | 134 | |
135 | 135 | foreach ($haystacks as $haystack) { |
136 | - if (Str::contains(Str::lower($haystack), $needles)) |
|
137 | - return true; |
|
136 | + if (Str::contains(Str::lower($haystack), $needles)) { |
|
137 | + return true; |
|
138 | + } |
|
138 | 139 | } |
139 | 140 | |
140 | 141 | return false; |
@@ -56,11 +56,13 @@ discard block |
||
56 | 56 | { |
57 | 57 | $user = $request->user(); |
58 | 58 | |
59 | - if (is_null($user)) |
|
60 | - return false; |
|
59 | + if (is_null($user)) { |
|
60 | + return false; |
|
61 | + } |
|
61 | 62 | |
62 | - if ( ! $user instanceof MustVerifyEmail) |
|
63 | - return false; |
|
63 | + if ( ! $user instanceof MustVerifyEmail) { |
|
64 | + return false; |
|
65 | + } |
|
64 | 66 | |
65 | 67 | return ! $user->hasVerifiedEmail(); |
66 | 68 | } |
@@ -75,8 +77,9 @@ discard block |
||
75 | 77 | */ |
76 | 78 | protected function getMustBeVerifiedResponse(Request $request, string $redirectToRoute) |
77 | 79 | { |
78 | - if ($request->expectsJson()) |
|
79 | - abort(Response::HTTP_FORBIDDEN, 'Your email address is not verified.'); |
|
80 | + if ($request->expectsJson()) { |
|
81 | + abort(Response::HTTP_FORBIDDEN, 'Your email address is not verified.'); |
|
82 | + } |
|
80 | 83 | |
81 | 84 | return redirect()->route($redirectToRoute); |
82 | 85 | } |
@@ -80,8 +80,9 @@ |
||
80 | 80 | */ |
81 | 81 | public function hasValidCode(): bool |
82 | 82 | { |
83 | - if (is_null($this->code)) |
|
84 | - return false; |
|
83 | + if (is_null($this->code)) { |
|
84 | + return false; |
|
85 | + } |
|
85 | 86 | |
86 | 87 | $secret = $this->twoFactor()->decrypted_secret; |
87 | 88 |
@@ -97,8 +97,9 @@ discard block |
||
97 | 97 | */ |
98 | 98 | protected function shouldUseTwoFactor($user): bool |
99 | 99 | { |
100 | - if ( ! Auth::isTwoFactorEnabled()) |
|
101 | - return false; |
|
100 | + if ( ! Auth::isTwoFactorEnabled()) { |
|
101 | + return false; |
|
102 | + } |
|
102 | 103 | |
103 | 104 | return optional($user)->isTwoFactorEnabled() |
104 | 105 | && in_array(HasTwoFactorAuthentication::class, class_uses_recursive($user)); |
@@ -140,8 +141,9 @@ discard block |
||
140 | 141 | */ |
141 | 142 | protected function twoFactorChallengeResponse(Request $request, $user) |
142 | 143 | { |
143 | - if ($request->wantsJson()) |
|
144 | - return new JsonResponse(['two_factor' => true]); |
|
144 | + if ($request->wantsJson()) { |
|
145 | + return new JsonResponse(['two_factor' => true]); |
|
146 | + } |
|
145 | 147 | |
146 | 148 | return redirect()->to($this->getTwoFactorUrl($request)); |
147 | 149 | } |
@@ -206,17 +206,21 @@ |
||
206 | 206 | */ |
207 | 207 | public function passes($attribute, $value): bool |
208 | 208 | { |
209 | - if ($this->requireUppercase && Str::lower($value) === $value) |
|
210 | - return $this->fail('The :attribute must contain at least one uppercase character.'); |
|
209 | + if ($this->requireUppercase && Str::lower($value) === $value) { |
|
210 | + return $this->fail('The :attribute must contain at least one uppercase character.'); |
|
211 | + } |
|
211 | 212 | |
212 | - if ($this->requireNumeric && ! preg_match('/[0-9]/', $value)) |
|
213 | - return $this->fail('The :attribute must contain at least one number.'); |
|
213 | + if ($this->requireNumeric && ! preg_match('/[0-9]/', $value)) { |
|
214 | + return $this->fail('The :attribute must contain at least one number.'); |
|
215 | + } |
|
214 | 216 | |
215 | - if ($this->requireSpecialCharacter && ! preg_match('/[\W_]/', $value)) |
|
216 | - return $this->fail('The :attribute must contain at least one special character.'); |
|
217 | + if ($this->requireSpecialCharacter && ! preg_match('/[\W_]/', $value)) { |
|
218 | + return $this->fail('The :attribute must contain at least one special character.'); |
|
219 | + } |
|
217 | 220 | |
218 | - if (Str::length($value) < $this->length) |
|
219 | - return $this->fail("The :attribute must be at least {$this->length} characters."); |
|
221 | + if (Str::length($value) < $this->length) { |
|
222 | + return $this->fail("The :attribute must be at least {$this->length} characters."); |
|
223 | + } |
|
220 | 224 | |
221 | 225 | return true; |
222 | 226 | } |
@@ -33,8 +33,9 @@ |
||
33 | 33 | */ |
34 | 34 | public function __construct(string $label = null) |
35 | 35 | { |
36 | - if ( ! empty($label)) |
|
37 | - $this->label = __($label); |
|
36 | + if ( ! empty($label)) { |
|
37 | + $this->label = __($label); |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | |
40 | 41 | /* ----------------------------------------------------------------- |
@@ -160,8 +160,9 @@ discard block |
||
160 | 160 | foreach ($model->getDirty() as $name => $value) { |
161 | 161 | $event = $name.'.'.$type; |
162 | 162 | |
163 | - if ( ! array_key_exists($event, $attributesEvents)) |
|
164 | - continue; |
|
163 | + if ( ! array_key_exists($event, $attributesEvents)) { |
|
164 | + continue; |
|
165 | + } |
|
165 | 166 | |
166 | 167 | return in_array($name, $model->getHidden()) |
167 | 168 | ? event(new $attributesEvents[$event]($model)) |
@@ -214,8 +215,9 @@ discard block |
||
214 | 215 | */ |
215 | 216 | public function activateOne(User $user) |
216 | 217 | { |
217 | - if ($user->isActive()) |
|
218 | - return false; |
|
218 | + if ($user->isActive()) { |
|
219 | + return false; |
|
220 | + } |
|
219 | 221 | |
220 | 222 | event(new ActivatingUser($user)); |
221 | 223 | $result = $user->forceFill(['activated_at' => $user->freshTimestamp()])->save(); |
@@ -233,8 +235,9 @@ discard block |
||
233 | 235 | */ |
234 | 236 | public function deactivateOne(User $user): bool |
235 | 237 | { |
236 | - if ( ! $user->isActive()) |
|
237 | - return false; |
|
238 | + if ( ! $user->isActive()) { |
|
239 | + return false; |
|
240 | + } |
|
238 | 241 | |
239 | 242 | event(new DeactivatingUser($user)); |
240 | 243 | $result = $user->forceFill(['activated_at' => null])->save(); |
@@ -264,8 +267,9 @@ discard block |
||
264 | 267 | */ |
265 | 268 | public function restoreOne(User $user) |
266 | 269 | { |
267 | - if ( ! $user->trashed()) |
|
268 | - return null; |
|
270 | + if ( ! $user->trashed()) { |
|
271 | + return null; |
|
272 | + } |
|
269 | 273 | |
270 | 274 | return $user->restore(); |
271 | 275 | } |
@@ -193,8 +193,9 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function syncPermissionsByIds(Role $role, array $ids): array |
195 | 195 | { |
196 | - if (empty($ids)) |
|
197 | - return []; |
|
196 | + if (empty($ids)) { |
|
197 | + return []; |
|
198 | + } |
|
198 | 199 | |
199 | 200 | event(new SyncingPermissions($role, $ids)); |
200 | 201 | $synced = $role->permissions()->sync($ids); |
@@ -302,8 +303,9 @@ discard block |
||
302 | 303 | */ |
303 | 304 | public function activateOne(Role $role): bool |
304 | 305 | { |
305 | - if ($role->isActive()) |
|
306 | - return false; |
|
306 | + if ($role->isActive()) { |
|
307 | + return false; |
|
308 | + } |
|
307 | 309 | |
308 | 310 | event(new ActivatingRole($role)); |
309 | 311 | $result = $role->forceFill(['activated_at' => $role->freshTimestamp()])->save(); |
@@ -321,8 +323,9 @@ discard block |
||
321 | 323 | */ |
322 | 324 | public function deactivateOne(Role $role): bool |
323 | 325 | { |
324 | - if ( ! $role->isActive()) |
|
325 | - return false; |
|
326 | + if ( ! $role->isActive()) { |
|
327 | + return false; |
|
328 | + } |
|
326 | 329 | |
327 | 330 | event(new DeactivatingRole($role)); |
328 | 331 | $result = $role->forceFill(['activated_at' => null])->save(); |
@@ -354,8 +357,9 @@ discard block |
||
354 | 357 | { |
355 | 358 | $roles = $this->get(); |
356 | 359 | |
357 | - if ($admin->isSuperAdmin()) |
|
358 | - return $roles; |
|
360 | + if ($admin->isSuperAdmin()) { |
|
361 | + return $roles; |
|
362 | + } |
|
359 | 363 | |
360 | 364 | return $roles->reject(function (Role $role) { |
361 | 365 | return $role->isAdministrator(); |