@@ -24,8 +24,8 @@ |
||
24 | 24 | */ |
25 | 25 | public function map(): void |
26 | 26 | { |
27 | - $this->adminGroup(function () { |
|
28 | - $this->name('settings.')->prefix('settings')->group(function () { |
|
27 | + $this->adminGroup(function() { |
|
28 | + $this->name('settings.')->prefix('settings')->group(function() { |
|
29 | 29 | // admin::auth.settings.index |
30 | 30 | $this->get('/', [SettingsController::class, 'index']) |
31 | 31 | ->name('index'); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->prefix('{'.self::USER_WILDCARD.'}')->group(function () { |
39 | 39 | // admin::auth.roles.administrators.detach |
40 | 40 | $this->delete('detach', [AdministratorsController::class, 'detach']) |
41 | - ->name('detach'); |
|
41 | + ->name('detach'); |
|
42 | 42 | }); |
43 | 43 | }); |
44 | 44 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function map(): void |
36 | 36 | { |
37 | - $this->prefix('administrators')->name('administrators.')->group(function () { |
|
38 | - $this->prefix('{'.self::USER_WILDCARD.'}')->group(function () { |
|
37 | + $this->prefix('administrators')->name('administrators.')->group(function() { |
|
38 | + $this->prefix('{'.self::USER_WILDCARD.'}')->group(function() { |
|
39 | 39 | // admin::auth.roles.administrators.detach |
40 | 40 | $this->delete('detach', [AdministratorsController::class, 'detach']) |
41 | 41 | ->name('detach'); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function bindings(RolesRepository $repo): void |
52 | 52 | { |
53 | - $this->bind(self::USER_WILDCARD, function (string $uuid, Route $route) use ($repo) { |
|
53 | + $this->bind(self::USER_WILDCARD, function(string $uuid, Route $route) use ($repo) { |
|
54 | 54 | /** @var \Arcanesoft\Foundation\Auth\Models\Role $role */ |
55 | 55 | $role = $route->parameter(RolesRoutes::ROLE_WILDCARD); |
56 | 56 |
@@ -28,11 +28,11 @@ |
||
28 | 28 | $this->name('password-resets.')->prefix('password-resets')->group(function () { |
29 | 29 | // admin::authorization.password-resets.index |
30 | 30 | $this->get('/', [PasswordResetsController::class, 'index']) |
31 | - ->name('index'); |
|
31 | + ->name('index'); |
|
32 | 32 | |
33 | 33 | // admin::authorization.password-resets.metrics |
34 | 34 | $this->get('metrics', [PasswordResetsController::class, 'metrics']) |
35 | - ->name('metrics'); |
|
35 | + ->name('metrics'); |
|
36 | 36 | }); |
37 | 37 | }); |
38 | 38 | } |
@@ -24,8 +24,8 @@ |
||
24 | 24 | */ |
25 | 25 | public function map(): void |
26 | 26 | { |
27 | - $this->adminGroup(function () { |
|
28 | - $this->name('password-resets.')->prefix('password-resets')->group(function () { |
|
27 | + $this->adminGroup(function() { |
|
28 | + $this->name('password-resets.')->prefix('password-resets')->group(function() { |
|
29 | 29 | // admin::authorization.password-resets.index |
30 | 30 | $this->get('/', [PasswordResetsController::class, 'index']) |
31 | 31 | ->name('index'); |
@@ -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 |
@@ -36,42 +36,42 @@ |
||
36 | 36 | $this->name('roles.')->prefix('roles')->group(function () { |
37 | 37 | // admin::auth.roles.index |
38 | 38 | $this->get('/', [RolesController::class, 'index']) |
39 | - ->name('index'); |
|
39 | + ->name('index'); |
|
40 | 40 | |
41 | 41 | // admin::auth.roles.metrics |
42 | 42 | $this->get('metrics', [RolesController::class, 'metrics']) |
43 | - ->name('metrics'); |
|
43 | + ->name('metrics'); |
|
44 | 44 | |
45 | 45 | // admin::auth.roles.create |
46 | 46 | $this->get('create', [RolesController::class, 'create']) |
47 | - ->name('create'); |
|
47 | + ->name('create'); |
|
48 | 48 | |
49 | 49 | // admin::auth.roles.store |
50 | 50 | $this->post('store', [RolesController::class, 'store']) |
51 | - ->name('store'); |
|
51 | + ->name('store'); |
|
52 | 52 | |
53 | 53 | $this->prefix('{'.self::ROLE_WILDCARD.'}')->group(function () { |
54 | 54 | // admin::auth.roles.show |
55 | 55 | $this->get('/', [RolesController::class, 'show']) |
56 | - ->name('show'); |
|
56 | + ->name('show'); |
|
57 | 57 | |
58 | 58 | // admin::auth.roles.edit |
59 | 59 | $this->get('edit', [RolesController::class, 'edit']) |
60 | - ->name('edit'); |
|
60 | + ->name('edit'); |
|
61 | 61 | |
62 | 62 | // admin::auth.roles.update |
63 | 63 | $this->put('update', [RolesController::class, 'update']) |
64 | - ->name('update'); |
|
64 | + ->name('update'); |
|
65 | 65 | |
66 | 66 | // admin::auth.roles.activate |
67 | 67 | $this->put('activate', [RolesController::class, 'activate']) |
68 | - ->middleware(['ajax']) |
|
69 | - ->name('activate'); |
|
68 | + ->middleware(['ajax']) |
|
69 | + ->name('activate'); |
|
70 | 70 | |
71 | 71 | // admin::auth.roles.delete |
72 | 72 | $this->delete('delete', [RolesController::class, 'delete']) |
73 | - ->middleware(['ajax']) |
|
74 | - ->name('delete'); |
|
73 | + ->middleware(['ajax']) |
|
74 | + ->name('delete'); |
|
75 | 75 | |
76 | 76 | $this->namespace('Roles')->group(function () { |
77 | 77 | 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('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 |
@@ -36,51 +36,51 @@ |
||
36 | 36 | $this->name('administrators.')->prefix('administrators')->group(function () { |
37 | 37 | // admin::auth.administrators.index |
38 | 38 | $this->get('/', [AdministratorsController::class, 'index']) |
39 | - ->name('index'); |
|
39 | + ->name('index'); |
|
40 | 40 | |
41 | 41 | // admin::auth.administrators.trash |
42 | 42 | $this->get('trash', [AdministratorsController::class, 'trash']) |
43 | - ->name('trash'); |
|
43 | + ->name('trash'); |
|
44 | 44 | |
45 | 45 | // admin::auth.administrators.metrics |
46 | 46 | $this->get('metrics', [AdministratorsController::class, 'metrics']) |
47 | - ->name('metrics'); |
|
47 | + ->name('metrics'); |
|
48 | 48 | |
49 | 49 | // admin::auth.administrators.create |
50 | 50 | $this->get('create', [AdministratorsController::class, 'create']) |
51 | - ->name('create'); |
|
51 | + ->name('create'); |
|
52 | 52 | |
53 | 53 | // admin::auth.administrators.post |
54 | 54 | $this->post('store', [AdministratorsController::class, 'store']) |
55 | - ->name('store'); |
|
55 | + ->name('store'); |
|
56 | 56 | |
57 | 57 | $this->prefix('{'.static::WILDCARD_ADMIN.'}')->group(function () { |
58 | 58 | // admin::auth.administrators.show |
59 | 59 | $this->get('/', [AdministratorsController::class, 'show']) |
60 | - ->name('show'); |
|
60 | + ->name('show'); |
|
61 | 61 | |
62 | 62 | // admin::auth.administrators.edit |
63 | 63 | $this->get('edit', [AdministratorsController::class, 'edit']) |
64 | - ->name('edit'); |
|
64 | + ->name('edit'); |
|
65 | 65 | |
66 | 66 | // admin::auth.administrators.update |
67 | 67 | $this->put('update', [AdministratorsController::class, 'update']) |
68 | - ->name('update'); |
|
68 | + ->name('update'); |
|
69 | 69 | |
70 | 70 | // admin::auth.administrators.activate |
71 | 71 | $this->put('activate', [AdministratorsController::class, 'activate']) |
72 | - ->middleware(['ajax']) |
|
73 | - ->name('activate'); |
|
72 | + ->middleware(['ajax']) |
|
73 | + ->name('activate'); |
|
74 | 74 | |
75 | 75 | // admin::auth.administrators.delete |
76 | 76 | $this->delete('delete', [AdministratorsController::class, 'delete']) |
77 | - ->middleware(['ajax']) |
|
78 | - ->name('delete'); |
|
77 | + ->middleware(['ajax']) |
|
78 | + ->name('delete'); |
|
79 | 79 | |
80 | 80 | // admin::auth.administrators.restore |
81 | 81 | $this->put('restore', [AdministratorsController::class, 'restore']) |
82 | - ->middleware(['ajax']) |
|
83 | - ->name('restore'); |
|
82 | + ->middleware(['ajax']) |
|
83 | + ->name('restore'); |
|
84 | 84 | |
85 | 85 | static::mapRouteClasses([ |
86 | 86 | Administrators\SessionsRoutes::class |
@@ -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 |
@@ -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 | } |