Skip to content

Commit 11c2abc

Browse files
authored
feat: allowing for permissions to be set on new role (#56)
1 parent 9aa421b commit 11c2abc

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Http/Controllers/Api/v2/RoleController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ public function postNew(NewRole $request)
209209

210210
$role->save();
211211

212+
if ($request->has('permissions'))
213+
$this->giveRolePermissions($role->id, $request->input('permissions'), false);
214+
215+
$role = Role::find($role->id);
216+
212217
return RoleResource::make($role);
213218
}
214219

src/Http/Validation/NewRole.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function rules()
5353
return [
5454
'title' => 'string|unique:roles,title|required',
5555
'description' => 'string',
56+
'permissions' => 'array',
5657
'logo' => 'base64image',
5758
];
5859
}

0 commit comments

Comments
 (0)