@@ -88,8 +88,9 @@ |
||
88 | 88 | */ |
89 | 89 | public function make(string $name): Component |
90 | 90 | { |
91 | - if ( ! $this->hasComponent($name)) |
|
92 | - throw ComponentNotFound::make($name); |
|
91 | + if ( ! $this->hasComponent($name)) { |
|
92 | + throw ComponentNotFound::make($name); |
|
93 | + } |
|
93 | 94 | |
94 | 95 | return $this->app->make($this->components[$name]); |
95 | 96 | } |
@@ -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 | } |
@@ -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, |
@@ -72,8 +72,9 @@ |
||
72 | 72 | */ |
73 | 73 | public function verified($date = null): self |
74 | 74 | { |
75 | - if (is_null($date)) |
|
76 | - $date = now(); |
|
75 | + if (is_null($date)) { |
|
76 | + $date = now(); |
|
77 | + } |
|
77 | 78 | |
78 | 79 | return $this->state([ |
79 | 80 | 'email_verified_at' => $date === false ? null : $date, |
@@ -170,10 +170,11 @@ |
||
170 | 170 | $data = $request->getValidatedData(); |
171 | 171 | $rolesRepo->updateOne($role, $data); |
172 | 172 | |
173 | - if (empty($permissions = $data['permissions'] ?: [])) |
|
174 | - $rolesRepo->detachAllPermissions($role); |
|
175 | - else |
|
176 | - $rolesRepo->syncPermissionsByUuids($role, $permissions); |
|
173 | + if (empty($permissions = $data['permissions'] ?: [])) { |
|
174 | + $rolesRepo->detachAllPermissions($role); |
|
175 | + } else { |
|
176 | + $rolesRepo->syncPermissionsByUuids($role, $permissions); |
|
177 | + } |
|
177 | 178 | |
178 | 179 | return redirect()->route('admin::auth.roles.show', [$role]); |
179 | 180 | } |
@@ -186,8 +186,9 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function syncPermissionsByIds(Role $role, array $ids): array |
188 | 188 | { |
189 | - if (empty($ids)) |
|
190 | - return []; |
|
189 | + if (empty($ids)) { |
|
190 | + return []; |
|
191 | + } |
|
191 | 192 | |
192 | 193 | event(new SyncingPermissions($role, $ids)); |
193 | 194 | $synced = $role->permissions()->sync($ids); |
@@ -307,8 +308,9 @@ discard block |
||
307 | 308 | { |
308 | 309 | $roles = $this->get(); |
309 | 310 | |
310 | - if ($admin->isSuperAdmin()) |
|
311 | - return $roles; |
|
311 | + if ($admin->isSuperAdmin()) { |
|
312 | + return $roles; |
|
313 | + } |
|
312 | 314 | |
313 | 315 | return $roles->reject(function (Role $role) { |
314 | 316 | return $role->isAdministrator(); |
@@ -147,8 +147,9 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function updateOne(Administrator $administrator, array $attributes): bool |
149 | 149 | { |
150 | - if ( ! $administrator->exists) |
|
151 | - return false; |
|
150 | + if ( ! $administrator->exists) { |
|
151 | + return false; |
|
152 | + } |
|
152 | 153 | |
153 | 154 | return $administrator->fill($attributes)->save(); |
154 | 155 | } |
@@ -210,8 +211,9 @@ discard block |
||
210 | 211 | */ |
211 | 212 | public function activate(Administrator $administrator) |
212 | 213 | { |
213 | - if ($administrator->isActive()) |
|
214 | - return false; |
|
214 | + if ($administrator->isActive()) { |
|
215 | + return false; |
|
216 | + } |
|
215 | 217 | |
216 | 218 | event(new ActivatingAdministrator($administrator)); |
217 | 219 | $result = $administrator->forceFill(['activated_at' => $administrator->freshTimestamp()])->save(); |
@@ -229,8 +231,9 @@ discard block |
||
229 | 231 | */ |
230 | 232 | public function deactivate(Administrator $administrator): bool |
231 | 233 | { |
232 | - if ( ! $administrator->isActive()) |
|
233 | - return false; |
|
234 | + if ( ! $administrator->isActive()) { |
|
235 | + return false; |
|
236 | + } |
|
234 | 237 | |
235 | 238 | event(new DeactivatingAdministrator($administrator)); |
236 | 239 | $result = $administrator->forceFill(['activated_at' => null])->save(); |
@@ -303,8 +306,9 @@ discard block |
||
303 | 306 | */ |
304 | 307 | public function syncRoles(Administrator $administrator, Collection $roles): array |
305 | 308 | { |
306 | - if (empty($roles)) |
|
307 | - return []; |
|
309 | + if (empty($roles)) { |
|
310 | + return []; |
|
311 | + } |
|
308 | 312 | |
309 | 313 | event(new SyncingRoles($administrator, $roles)); |
310 | 314 | $synced = $administrator->roles()->sync($roles->pluck('id')); |
@@ -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 | } |
@@ -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 |