@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | public function handle(ServerRequestInterface $request): ResponseInterface |
| 139 | 139 | { |
| 140 | 140 | $permissions = $this->permissionRepository |
| 141 | - ->orderBy('code') |
|
| 142 | - ->all(); |
|
| 141 | + ->orderBy('code') |
|
| 142 | + ->all(); |
|
| 143 | 143 | |
| 144 | 144 | if ($request->getMethod() === 'GET') { |
| 145 | 145 | return new TemplateResponse( |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | $this->template, |
| 179 | 179 | 'role/create', |
| 180 | 180 | [ |
| 181 | - 'param' => $formParam, |
|
| 182 | - 'permissions' => $permissions |
|
| 181 | + 'param' => $formParam, |
|
| 182 | + 'permissions' => $permissions |
|
| 183 | 183 | ] |
| 184 | 184 | ); |
| 185 | 185 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | 'description' => $formParam->getDescription() |
| 191 | 191 | ]); |
| 192 | 192 | |
| 193 | - //Handle permissions |
|
| 193 | + //Handle permissions |
|
| 194 | 194 | $permissionsId = $param->post('permissions', []); |
| 195 | 195 | if (!empty($permissionsId)) { |
| 196 | 196 | $selectedPermissions = $this->permissionRepository->findAll(...$permissionsId); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | $this->template, |
| 208 | 208 | 'role/create', |
| 209 | 209 | [ |
| 210 | - 'param' => $formParam, |
|
| 210 | + 'param' => $formParam, |
|
| 211 | 211 | 'permissions' => $permissions |
| 212 | 212 | ] |
| 213 | 213 | ); |
@@ -125,8 +125,8 @@ |
||
| 125 | 125 | { |
| 126 | 126 | $id = (int) $request->getAttribute('id'); |
| 127 | 127 | $role = $this->roleRepository |
| 128 | - ->with('permissions') |
|
| 129 | - ->find($id); |
|
| 128 | + ->with('permissions') |
|
| 129 | + ->find($id); |
|
| 130 | 130 | if (!$role) { |
| 131 | 131 | $this->session->setFlash('error', 'Can not find the role'); |
| 132 | 132 | $this->logger->warning('Can not find role with id {id}', ['id' => $id]); |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | protected RouteHelper $routeHelper; |
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * The password hash to be used |
|
| 114 | - * @var HashInterface |
|
| 115 | - */ |
|
| 112 | + /** |
|
| 113 | + * The password hash to be used |
|
| 114 | + * @var HashInterface |
|
| 115 | + */ |
|
| 116 | 116 | protected HashInterface $hash; |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $permissions = $this->permissionRepository |
| 167 | - ->orderBy('code') |
|
| 168 | - ->all(); |
|
| 167 | + ->orderBy('code') |
|
| 168 | + ->all(); |
|
| 169 | 169 | |
| 170 | 170 | $currentPermissionsId = []; |
| 171 | 171 | foreach ($role->permissions as $entity) { |
@@ -212,8 +212,8 @@ discard block |
||
| 212 | 212 | $this->template, |
| 213 | 213 | 'role/edit', |
| 214 | 214 | [ |
| 215 | - 'param' => $formParam, |
|
| 216 | - 'permissions' => $permissions |
|
| 215 | + 'param' => $formParam, |
|
| 216 | + 'permissions' => $permissions |
|
| 217 | 217 | ] |
| 218 | 218 | ); |
| 219 | 219 | } |
@@ -246,8 +246,8 @@ discard block |
||
| 246 | 246 | $this->template, |
| 247 | 247 | 'role/edit', |
| 248 | 248 | [ |
| 249 | - 'param' => $formParam, |
|
| 250 | - 'permissions' => $permissions |
|
| 249 | + 'param' => $formParam, |
|
| 250 | + 'permissions' => $permissions |
|
| 251 | 251 | ] |
| 252 | 252 | ); |
| 253 | 253 | } |
@@ -92,12 +92,12 @@ |
||
| 92 | 92 | public function setRules(): void |
| 93 | 93 | { |
| 94 | 94 | $this->validator->addRules('name', [ |
| 95 | - new NotEmpty(), |
|
| 96 | - new MinLength(2) |
|
| 95 | + new NotEmpty(), |
|
| 96 | + new MinLength(2) |
|
| 97 | 97 | ]); |
| 98 | 98 | |
| 99 | 99 | $this->validator->addRules('description', [ |
| 100 | - new MinLength(3) |
|
| 100 | + new MinLength(3) |
|
| 101 | 101 | ]); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -10,25 +10,25 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | public function up(): void |
| 12 | 12 | { |
| 13 | - //Action when migrate up |
|
| 13 | + //Action when migrate up |
|
| 14 | 14 | $this->create('permissions', function (CreateTable $table) { |
| 15 | 15 | $table->integer('id') |
| 16 | - ->autoincrement() |
|
| 17 | - ->primary(); |
|
| 16 | + ->autoincrement() |
|
| 17 | + ->primary(); |
|
| 18 | 18 | $table->string('code') |
| 19 | - ->description('The permission code') |
|
| 20 | - ->unique() |
|
| 21 | - ->notNull(); |
|
| 19 | + ->description('The permission code') |
|
| 20 | + ->unique() |
|
| 21 | + ->notNull(); |
|
| 22 | 22 | $table->string('description') |
| 23 | - ->description('The permission description') |
|
| 24 | - ->notNull(); |
|
| 23 | + ->description('The permission description') |
|
| 24 | + ->notNull(); |
|
| 25 | 25 | $table->string('depend') |
| 26 | - ->description('The permission dependency'); |
|
| 26 | + ->description('The permission dependency'); |
|
| 27 | 27 | $table->datetime('created_at') |
| 28 | - ->description('permission created at') |
|
| 29 | - ->notNull(); |
|
| 28 | + ->description('permission created at') |
|
| 29 | + ->notNull(); |
|
| 30 | 30 | $table->datetime('updated_at') |
| 31 | - ->description('permission updated at'); |
|
| 31 | + ->description('permission updated at'); |
|
| 32 | 32 | |
| 33 | 33 | $table->engine('INNODB'); |
| 34 | 34 | }); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function down(): void |
| 38 | 38 | { |
| 39 | - //Action when migrate down |
|
| 39 | + //Action when migrate down |
|
| 40 | 40 | $this->drop('permissions'); |
| 41 | 41 | } |
| 42 | 42 | } |