Commit 3d25b881 authored by Nicolas Widart's avatar Nicolas Widart

Able to add multiple roles to user.

parent 63119351
...@@ -32,12 +32,13 @@ class SentryUserRepository implements UserRepository ...@@ -32,12 +32,13 @@ class SentryUserRepository implements UserRepository
*/ */
public function createWithRoles($data, $roles) public function createWithRoles($data, $roles)
{ {
$user = Sentry::createUser($data); $user = Sentry::createUser(array_merge($data, ['activated' => true]));
if (!empty($roles)) { if (!empty($roles)) {
$group = Sentry::findGroupByName($roles); foreach ($roles as $roleId) {
$user->addGroup($group); $group = Sentry::findGroupById($roleId);
$user->addGroup($group);
}
} }
$user->attemptActivation($user->getActivationCode());
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment