@@ -28,20 +28,20 @@ |
||
28 | 28 | $this->prefix('profile')->name('profile.')->middleware(['administrator.password.confirm'])->group(function () { |
29 | 29 | // admin::auth.profile.index |
30 | 30 | $this->get('/', [ProfileController::class, 'index']) |
31 | - ->name('index'); |
|
31 | + ->name('index'); |
|
32 | 32 | |
33 | 33 | // Account |
34 | 34 | $this->prefix('account')->name('account.')->group(function () { |
35 | 35 | // admin::auth.profile.account.update |
36 | 36 | $this->put('update', [ProfileController::class, 'updateAccount']) |
37 | - ->name('update'); |
|
37 | + ->name('update'); |
|
38 | 38 | }); |
39 | 39 | |
40 | 40 | // Password |
41 | 41 | $this->prefix('password')->name('password.')->group(function () { |
42 | 42 | // admin::auth.profile.password.update |
43 | 43 | $this->put('update', [ProfileController::class, 'updatePassword']) |
44 | - ->name('update'); |
|
44 | + ->name('update'); |
|
45 | 45 | }); |
46 | 46 | }); |
47 | 47 | }); |
@@ -24,21 +24,21 @@ |
||
24 | 24 | */ |
25 | 25 | public function map(): void |
26 | 26 | { |
27 | - $this->adminGroup(function () { |
|
28 | - $this->prefix('profile')->name('profile.')->middleware(['administrator.password.confirm'])->group(function () { |
|
27 | + $this->adminGroup(function() { |
|
28 | + $this->prefix('profile')->name('profile.')->middleware(['administrator.password.confirm'])->group(function() { |
|
29 | 29 | // admin::auth.profile.index |
30 | 30 | $this->get('/', [ProfileController::class, 'index']) |
31 | 31 | ->name('index'); |
32 | 32 | |
33 | 33 | // Account |
34 | - $this->prefix('account')->name('account.')->group(function () { |
|
34 | + $this->prefix('account')->name('account.')->group(function() { |
|
35 | 35 | // admin::auth.profile.account.update |
36 | 36 | $this->put('update', [ProfileController::class, 'updateAccount']) |
37 | 37 | ->name('update'); |
38 | 38 | }); |
39 | 39 | |
40 | 40 | // Password |
41 | - $this->prefix('password')->name('password.')->group(function () { |
|
41 | + $this->prefix('password')->name('password.')->group(function() { |
|
42 | 42 | // admin::auth.profile.password.update |
43 | 43 | $this->put('update', [ProfileController::class, 'updatePassword']) |
44 | 44 | ->name('update'); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $this->name('sessions.')->name('prefix')->group(function () { |
37 | 37 | $this->prefix('{'.static::WILDCARD_SESSION.'}')->group(function () { |
38 | 38 | $this->delete('delete', [SessionsController::class, 'delete']) |
39 | - ->name('delete'); // admin::auth.administrators.sessions.delete |
|
39 | + ->name('delete'); // admin::auth.administrators.sessions.delete |
|
40 | 40 | }); |
41 | 41 | }); |
42 | 42 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function map(): void |
35 | 35 | { |
36 | - $this->name('sessions.')->name('prefix')->group(function () { |
|
37 | - $this->prefix('{'.static::WILDCARD_SESSION.'}')->group(function () { |
|
36 | + $this->name('sessions.')->name('prefix')->group(function() { |
|
37 | + $this->prefix('{'.static::WILDCARD_SESSION.'}')->group(function() { |
|
38 | 38 | $this->delete('delete', [SessionsController::class, 'delete']) |
39 | 39 | ->name('delete'); // admin::auth.administrators.sessions.delete |
40 | 40 | }); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function bindings(SessionsRepository $repo): void |
50 | 50 | { |
51 | - $this->bind(static::WILDCARD_SESSION, function (string $uuid) use ($repo) { |
|
51 | + $this->bind(static::WILDCARD_SESSION, function(string $uuid) use ($repo) { |
|
52 | 52 | return $repo->firstByIdOrFail($uuid); |
53 | 53 | }); |
54 | 54 | } |
@@ -36,12 +36,12 @@ |
||
36 | 36 | $this->prefix('permissions')->name('permissions.')->group(function () { |
37 | 37 | // admin::auth.permissions.index |
38 | 38 | $this->get('/', [PermissionsController::class, 'index']) |
39 | - ->name('index'); |
|
39 | + ->name('index'); |
|
40 | 40 | |
41 | 41 | $this->prefix('{'.self::PERMISSION_WILDCARD.'}')->group(function () { |
42 | 42 | // admin::auth.permissions.show |
43 | 43 | $this->get('/', [PermissionsController::class, 'show']) |
44 | - ->name('show'); |
|
44 | + ->name('show'); |
|
45 | 45 | |
46 | 46 | $this->namespace('Permissions')->group(function () { |
47 | 47 | static::mapRouteClasses([ |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function map(): void |
34 | 34 | { |
35 | - $this->adminGroup(function () { |
|
36 | - $this->prefix('permissions')->name('permissions.')->group(function () { |
|
35 | + $this->adminGroup(function() { |
|
36 | + $this->prefix('permissions')->name('permissions.')->group(function() { |
|
37 | 37 | // admin::auth.permissions.index |
38 | 38 | $this->get('/', [PermissionsController::class, 'index']) |
39 | 39 | ->name('index'); |
40 | 40 | |
41 | - $this->prefix('{'.self::PERMISSION_WILDCARD.'}')->group(function () { |
|
41 | + $this->prefix('{'.self::PERMISSION_WILDCARD.'}')->group(function() { |
|
42 | 42 | // admin::auth.permissions.show |
43 | 43 | $this->get('/', [PermissionsController::class, 'show']) |
44 | 44 | ->name('show'); |
45 | 45 | |
46 | - $this->namespace('Permissions')->group(function () { |
|
46 | + $this->namespace('Permissions')->group(function() { |
|
47 | 47 | static::mapRouteClasses([ |
48 | 48 | Permissions\RolesRoutes::class, |
49 | 49 | ]); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function bindings(PermissionsRepository $repo): void |
62 | 62 | { |
63 | - $this->bind(self::PERMISSION_WILDCARD, function (string $uuid) use ($repo) { |
|
63 | + $this->bind(self::PERMISSION_WILDCARD, function(string $uuid) use ($repo) { |
|
64 | 64 | return $repo->firstOrFailWhereUuid($uuid); |
65 | 65 | }); |
66 | 66 |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function map(): void |
34 | 34 | { |
35 | - $this->adminGroup(function () { |
|
36 | - $this->name('roles.')->prefix('roles')->group(function () { |
|
35 | + $this->adminGroup(function() { |
|
36 | + $this->name('roles.')->prefix('roles')->group(function() { |
|
37 | 37 | // admin::auth.roles.index |
38 | 38 | $this->get('/', [RolesController::class, 'index']) |
39 | 39 | ->name('index'); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $this->post('store', [RolesController::class, 'store']) |
51 | 51 | ->name('store'); |
52 | 52 | |
53 | - $this->prefix('{'.self::ROLE_WILDCARD.'}')->group(function () { |
|
53 | + $this->prefix('{'.self::ROLE_WILDCARD.'}')->group(function() { |
|
54 | 54 | // admin::auth.roles.show |
55 | 55 | $this->get('/', [RolesController::class, 'show']) |
56 | 56 | ->name('show'); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ->middleware(['ajax']) |
74 | 74 | ->name('delete'); |
75 | 75 | |
76 | - $this->namespace('Roles')->group(function () { |
|
76 | + $this->namespace('Roles')->group(function() { |
|
77 | 77 | static::mapRouteClasses([ |
78 | 78 | Roles\AdministratorsRoutes::class, |
79 | 79 | Roles\PermissionsRoutes::class, |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function bindings(RolesRepository $repo): void |
93 | 93 | { |
94 | - $this->bind(self::ROLE_WILDCARD, function (string $uuid) use ($repo) { |
|
94 | + $this->bind(self::ROLE_WILDCARD, function(string $uuid) use ($repo) { |
|
95 | 95 | return $repo->firstWithUuidOrFail($uuid); |
96 | 96 | }); |
97 | 97 |
@@ -35,47 +35,47 @@ |
||
35 | 35 | $this->name('roles.')->prefix('roles')->group(function () { |
36 | 36 | // admin::auth.roles.index |
37 | 37 | $this->get('/', [RolesController::class, 'index']) |
38 | - ->name('index'); |
|
38 | + ->name('index'); |
|
39 | 39 | |
40 | 40 | // admin::auth.roles.metrics |
41 | 41 | $this->get('metrics', [RolesController::class, 'metrics']) |
42 | - ->name('metrics'); |
|
42 | + ->name('metrics'); |
|
43 | 43 | |
44 | 44 | // admin::auth.roles.create |
45 | 45 | $this->get('create', [RolesController::class, 'create']) |
46 | - ->name('create'); |
|
46 | + ->name('create'); |
|
47 | 47 | |
48 | 48 | // admin::auth.roles.store |
49 | 49 | $this->post('store', [RolesController::class, 'store']) |
50 | - ->name('store'); |
|
50 | + ->name('store'); |
|
51 | 51 | |
52 | 52 | $this->prefix('{'.self::ROLE_WILDCARD.'}')->group(function () { |
53 | 53 | // admin::auth.roles.show |
54 | 54 | $this->get('/', [RolesController::class, 'show']) |
55 | - ->name('show'); |
|
55 | + ->name('show'); |
|
56 | 56 | |
57 | 57 | // admin::auth.roles.edit |
58 | 58 | $this->get('edit', [RolesController::class, 'edit']) |
59 | - ->name('edit'); |
|
59 | + ->name('edit'); |
|
60 | 60 | |
61 | 61 | // admin::auth.roles.update |
62 | 62 | $this->put('update', [RolesController::class, 'update']) |
63 | - ->name('update'); |
|
63 | + ->name('update'); |
|
64 | 64 | |
65 | 65 | // admin::auth.roles.activate |
66 | 66 | $this->put('activate', [RolesController::class, 'activate']) |
67 | - ->middleware(['ajax']) |
|
68 | - ->name('activate'); |
|
67 | + ->middleware(['ajax']) |
|
68 | + ->name('activate'); |
|
69 | 69 | |
70 | 70 | // admin::auth.roles.deactivate |
71 | 71 | $this->put('deactivate', [RolesController::class, 'deactivate']) |
72 | - ->middleware(['ajax']) |
|
73 | - ->name('deactivate'); |
|
72 | + ->middleware(['ajax']) |
|
73 | + ->name('deactivate'); |
|
74 | 74 | |
75 | 75 | // admin::auth.roles.delete |
76 | 76 | $this->delete('delete', [RolesController::class, 'delete']) |
77 | - ->middleware(['ajax']) |
|
78 | - ->name('delete'); |
|
77 | + ->middleware(['ajax']) |
|
78 | + ->name('delete'); |
|
79 | 79 | |
80 | 80 | $this->namespace('Roles')->group(function () { |
81 | 81 | static::mapRouteClasses([ |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function map(): void |
34 | 34 | { |
35 | - $this->adminGroup(function () { |
|
36 | - $this->name('administrators.')->prefix('administrators')->group(function () { |
|
35 | + $this->adminGroup(function() { |
|
36 | + $this->name('administrators.')->prefix('administrators')->group(function() { |
|
37 | 37 | // admin::auth.administrators.index |
38 | 38 | $this->get('/', [AdministratorsController::class, 'index']) |
39 | 39 | ->name('index'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->post('store', [AdministratorsController::class, 'store']) |
55 | 55 | ->name('store'); |
56 | 56 | |
57 | - $this->prefix('{'.static::WILDCARD_ADMIN.'}')->group(function () { |
|
57 | + $this->prefix('{'.static::WILDCARD_ADMIN.'}')->group(function() { |
|
58 | 58 | // admin::auth.administrators.show |
59 | 59 | $this->get('/', [AdministratorsController::class, 'show']) |
60 | 60 | ->name('show'); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function bindings(AdministratorsRepository $repo): void |
99 | 99 | { |
100 | - $this->bind(static::WILDCARD_ADMIN, function (string $uuid) use ($repo) { |
|
100 | + $this->bind(static::WILDCARD_ADMIN, function(string $uuid) use ($repo) { |
|
101 | 101 | return $repo->firstWhereUuidOrFail($uuid); |
102 | 102 | }); |
103 | 103 |
@@ -35,56 +35,56 @@ |
||
35 | 35 | $this->name('administrators.')->prefix('administrators')->group(function () { |
36 | 36 | // admin::auth.administrators.index |
37 | 37 | $this->get('/', [AdministratorsController::class, 'index']) |
38 | - ->name('index'); |
|
38 | + ->name('index'); |
|
39 | 39 | |
40 | 40 | // admin::auth.administrators.trash |
41 | 41 | $this->get('trash', [AdministratorsController::class, 'trash']) |
42 | - ->name('trash'); |
|
42 | + ->name('trash'); |
|
43 | 43 | |
44 | 44 | // admin::auth.administrators.metrics |
45 | 45 | $this->get('metrics', [AdministratorsController::class, 'metrics']) |
46 | - ->name('metrics'); |
|
46 | + ->name('metrics'); |
|
47 | 47 | |
48 | 48 | // admin::auth.administrators.create |
49 | 49 | $this->get('create', [AdministratorsController::class, 'create']) |
50 | - ->name('create'); |
|
50 | + ->name('create'); |
|
51 | 51 | |
52 | 52 | // admin::auth.administrators.post |
53 | 53 | $this->post('store', [AdministratorsController::class, 'store']) |
54 | - ->name('store'); |
|
54 | + ->name('store'); |
|
55 | 55 | |
56 | 56 | $this->prefix('{'.static::WILDCARD_ADMIN.'}')->group(function () { |
57 | 57 | // admin::auth.administrators.show |
58 | 58 | $this->get('/', [AdministratorsController::class, 'show']) |
59 | - ->name('show'); |
|
59 | + ->name('show'); |
|
60 | 60 | |
61 | 61 | // admin::auth.administrators.edit |
62 | 62 | $this->get('edit', [AdministratorsController::class, 'edit']) |
63 | - ->name('edit'); |
|
63 | + ->name('edit'); |
|
64 | 64 | |
65 | 65 | // admin::auth.administrators.update |
66 | 66 | $this->put('update', [AdministratorsController::class, 'update']) |
67 | - ->name('update'); |
|
67 | + ->name('update'); |
|
68 | 68 | |
69 | 69 | // admin::auth.administrators.activate |
70 | 70 | $this->put('activate', [AdministratorsController::class, 'activate']) |
71 | - ->middleware(['ajax']) |
|
72 | - ->name('activate'); |
|
71 | + ->middleware(['ajax']) |
|
72 | + ->name('activate'); |
|
73 | 73 | |
74 | 74 | // admin::auth.administrators.deactivate |
75 | 75 | $this->put('deactivate', [AdministratorsController::class, 'deactivate']) |
76 | - ->middleware(['ajax']) |
|
77 | - ->name('deactivate'); |
|
76 | + ->middleware(['ajax']) |
|
77 | + ->name('deactivate'); |
|
78 | 78 | |
79 | 79 | // admin::auth.administrators.delete |
80 | 80 | $this->delete('delete', [AdministratorsController::class, 'delete']) |
81 | - ->middleware(['ajax']) |
|
82 | - ->name('delete'); |
|
81 | + ->middleware(['ajax']) |
|
82 | + ->name('delete'); |
|
83 | 83 | |
84 | 84 | // admin::auth.administrators.restore |
85 | 85 | $this->put('restore', [AdministratorsController::class, 'restore']) |
86 | - ->middleware(['ajax']) |
|
87 | - ->name('restore'); |
|
86 | + ->middleware(['ajax']) |
|
87 | + ->name('restore'); |
|
88 | 88 | |
89 | 89 | static::mapRouteClasses([ |
90 | 90 | Administrators\SessionsRoutes::class |
@@ -59,7 +59,7 @@ |
||
59 | 59 | */ |
60 | 60 | public function createOneWithPermissions(array $attributes, iterable $permissions) |
61 | 61 | { |
62 | - return tap($this->createOne($attributes), function (PermissionsGroup $group) use ($permissions) { |
|
62 | + return tap($this->createOne($attributes), function(PermissionsGroup $group) use ($permissions) { |
|
63 | 63 | $group->permissions()->saveMany($permissions); |
64 | 64 | }); |
65 | 65 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function createOne(array $attributes): Role |
143 | 143 | { |
144 | - return tap($this->create($attributes), function (Role $role) use ($attributes) { |
|
144 | + return tap($this->create($attributes), function(Role $role) use ($attributes) { |
|
145 | 145 | $this->syncPermissionsByUuids($role, $attributes['permissions'] ?: []); |
146 | 146 | }); |
147 | 147 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if ($admin->isSuperAdmin()) |
311 | 311 | return $roles; |
312 | 312 | |
313 | - return $roles->reject(function (Role $role) { |
|
313 | + return $roles->reject(function(Role $role) { |
|
314 | 314 | return $role->isAdministrator(); |
315 | 315 | }); |
316 | 316 | } |
@@ -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(); |
@@ -111,7 +111,7 @@ |
||
111 | 111 | 'password' => null, |
112 | 112 | ]; |
113 | 113 | |
114 | - return tap($this->getUsersRepository()->createOne($attributes), function ($user) { |
|
114 | + return tap($this->getUsersRepository()->createOne($attributes), function($user) { |
|
115 | 115 | event(new UserRegistered($user)); |
116 | 116 | }); |
117 | 117 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function onlyTrashed(bool $condition = true) |
78 | 78 | { |
79 | - return $this->when($condition, function (Builder $q) { |
|
79 | + return $this->when($condition, function(Builder $q) { |
|
80 | 80 | return $q->onlyTrashed(); |
81 | 81 | }); |
82 | 82 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $attributes['password'] = $attributes['password'] ?? Str::random(8); |
114 | 114 | |
115 | - return tap($this->model()->fill($attributes), function (Administrator $administrator) use ($attributes) { |
|
115 | + return tap($this->model()->fill($attributes), function(Administrator $administrator) use ($attributes) { |
|
116 | 116 | $administrator->forceFill([ |
117 | 117 | 'activated_at' => $attributes['activated_at'] ?? now(), // TODO: Add a setting to change this |
118 | 118 | ]); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | $roles = $attributes['roles']; |
134 | 134 | |
135 | - return tap($this->createOne($attributes), function ($administrator) use ($roles) { |
|
135 | + return tap($this->createOne($attributes), function($administrator) use ($roles) { |
|
136 | 136 | $this->syncRolesByUuids($administrator, $roles); |
137 | 137 | }); |
138 | 138 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | { |
166 | 166 | $roles = $attributes['roles']; |
167 | 167 | |
168 | - return tap($this->updateOne($administrator, $attributes), function () use ($administrator, $roles) { |
|
168 | + return tap($this->updateOne($administrator, $attributes), function() use ($administrator, $roles) { |
|
169 | 169 | $this->syncRolesByUuids($administrator, $roles); |
170 | 170 | }); |
171 | 171 | } |
@@ -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')); |