@@ -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 | } |
@@ -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(); |
@@ -146,8 +146,9 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function updateOne(Administrator $administrator, array $attributes): bool |
148 | 148 | { |
149 | - if ( ! $administrator->exists) |
|
150 | - return false; |
|
149 | + if ( ! $administrator->exists) { |
|
150 | + return false; |
|
151 | + } |
|
151 | 152 | |
152 | 153 | return $administrator->fill($attributes)->save(); |
153 | 154 | } |
@@ -209,8 +210,9 @@ discard block |
||
209 | 210 | */ |
210 | 211 | public function activateOne(Administrator $administrator) |
211 | 212 | { |
212 | - if ($administrator->isActive()) |
|
213 | - return false; |
|
213 | + if ($administrator->isActive()) { |
|
214 | + return false; |
|
215 | + } |
|
214 | 216 | |
215 | 217 | event(new ActivatingAdministrator($administrator)); |
216 | 218 | $result = $administrator->forceFill(['activated_at' => $administrator->freshTimestamp()])->save(); |
@@ -228,8 +230,9 @@ discard block |
||
228 | 230 | */ |
229 | 231 | public function deactivateOne(Administrator $administrator): bool |
230 | 232 | { |
231 | - if ( ! $administrator->isActive()) |
|
232 | - return false; |
|
233 | + if ( ! $administrator->isActive()) { |
|
234 | + return false; |
|
235 | + } |
|
233 | 236 | |
234 | 237 | event(new DeactivatingAdministrator($administrator)); |
235 | 238 | $result = $administrator->forceFill(['activated_at' => null])->save(); |
@@ -302,8 +305,9 @@ discard block |
||
302 | 305 | */ |
303 | 306 | public function syncRoles(Administrator $administrator, Collection $roles): array |
304 | 307 | { |
305 | - if (empty($roles)) |
|
306 | - return []; |
|
308 | + if (empty($roles)) { |
|
309 | + return []; |
|
310 | + } |
|
307 | 311 | |
308 | 312 | event(new SyncingRoles($administrator, $roles)); |
309 | 313 | $synced = $administrator->roles()->sync($roles->pluck('id')); |
@@ -54,11 +54,13 @@ |
||
54 | 54 | { |
55 | 55 | $session = $event->session; |
56 | 56 | |
57 | - if ($session->isVisitor()) |
|
58 | - return; |
|
57 | + if ($session->isVisitor()) { |
|
58 | + return; |
|
59 | + } |
|
59 | 60 | |
60 | - if ( ! $session->isSameUser($authenticated = $this->getAuthenticated())) |
|
61 | - return; |
|
61 | + if ( ! $session->isSameUser($authenticated = $this->getAuthenticated())) { |
|
62 | + return; |
|
63 | + } |
|
62 | 64 | |
63 | 65 | $authenticated->forceFill([ |
64 | 66 | 'last_activity_at' => $session->last_activity_at, |