Skip to content

Commit

Permalink
feat: allowing for permissions to be set on new role (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrancell authored Dec 30, 2020
1 parent 9aa421b commit 11c2abc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Http/Controllers/Api/v2/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ public function postNew(NewRole $request)

$role->save();

if ($request->has('permissions'))
$this->giveRolePermissions($role->id, $request->input('permissions'), false);

$role = Role::find($role->id);

return RoleResource::make($role);
}

Expand Down
1 change: 1 addition & 0 deletions src/Http/Validation/NewRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function rules()
return [
'title' => 'string|unique:roles,title|required',
'description' => 'string',
'permissions' => 'array',
'logo' => 'base64image',
];
}
Expand Down

0 comments on commit 11c2abc

Please sign in to comment.