@@ -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, |
@@ -65,14 +65,17 @@ |
||
65 | 65 | $with = $options['with'] ?? []; |
66 | 66 | $fields = $options['fields'] ?? []; |
67 | 67 | |
68 | - if ( ! empty($scopes)) |
|
69 | - $socialite->scopes($scopes); |
|
68 | + if ( ! empty($scopes)) { |
|
69 | + $socialite->scopes($scopes); |
|
70 | + } |
|
70 | 71 | |
71 | - if ( ! empty($with)) |
|
72 | - $socialite->with($with); |
|
72 | + if ( ! empty($with)) { |
|
73 | + $socialite->with($with); |
|
74 | + } |
|
73 | 75 | |
74 | - if ( ! empty($fields)) |
|
75 | - $socialite->fields($fields); |
|
76 | + if ( ! empty($fields)) { |
|
77 | + $socialite->fields($fields); |
|
78 | + } |
|
76 | 79 | })->redirect(); |
77 | 80 | } |
78 | 81 |
@@ -31,8 +31,9 @@ |
||
31 | 31 | */ |
32 | 32 | public function handle($request, Closure $next, $guard = null) |
33 | 33 | { |
34 | - if (Auth::guard($guard)->check()) |
|
35 | - Auth::guard($guard)->user()->updateLastActivity(); |
|
34 | + if (Auth::guard($guard)->check()) { |
|
35 | + Auth::guard($guard)->user()->updateLastActivity(); |
|
36 | + } |
|
36 | 37 | |
37 | 38 | return $next($request); |
38 | 39 | } |
@@ -98,8 +98,9 @@ discard block |
||
98 | 98 | { |
99 | 99 | $session = $this->findSession($sessionId); |
100 | 100 | |
101 | - if (is_null($session)) |
|
102 | - return ''; |
|
101 | + if (is_null($session)) { |
|
102 | + return ''; |
|
103 | + } |
|
103 | 104 | |
104 | 105 | if ($session->hasExpired()) { |
105 | 106 | $this->exists = true; |
@@ -148,8 +149,7 @@ discard block |
||
148 | 149 | |
149 | 150 | try { |
150 | 151 | return $this->repo->newModelInstance($attributes)->save(); |
151 | - } |
|
152 | - catch (QueryException $e) { |
|
152 | + } catch (QueryException $e) { |
|
153 | 153 | $this->performUpdate($sessionId, $attributes); |
154 | 154 | } |
155 | 155 |
@@ -72,8 +72,9 @@ discard block |
||
72 | 72 | */ |
73 | 73 | private static function getAuthProviderKey($notifiable): string |
74 | 74 | { |
75 | - if ($notifiable instanceof Administrator) |
|
76 | - return 'admins'; |
|
75 | + if ($notifiable instanceof Administrator) { |
|
76 | + return 'admins'; |
|
77 | + } |
|
77 | 78 | |
78 | 79 | return 'users'; |
79 | 80 | } |
@@ -87,8 +88,9 @@ discard block |
||
87 | 88 | */ |
88 | 89 | protected static function getPasswordResetRoute($authProviderKey): string |
89 | 90 | { |
90 | - if ($authProviderKey === 'admins') |
|
91 | - return 'admin::auth.password.reset'; |
|
91 | + if ($authProviderKey === 'admins') { |
|
92 | + return 'admin::auth.password.reset'; |
|
93 | + } |
|
92 | 94 | |
93 | 95 | return 'auth::password.reset'; |
94 | 96 | } |