Commit 95c64d28 authored by Nicolas Widart's avatar Nicolas Widart

Merge pull request #2 from nWidart-Modules/CheckForEmptyRoles

Check for empty roles on store and update
parents 0e80e5ad b9819baf
......@@ -49,7 +49,9 @@ class SentinelUserRepository implements UserRepository
public function createWithRoles($data, $roles)
{
$user = $this->user->create($data);
$user->roles()->attach($roles);
if (!empty($roles)) {
$user->roles()->attach($roles);
}
$code = Activation::create($user);
Activation::complete($user, $code);
......@@ -90,7 +92,9 @@ class SentinelUserRepository implements UserRepository
$user = $user->fill($data);
$user->save();
$user->roles()->sync($roles);
if (!empty($roles)) {
$user->roles()->sync($roles);
}
}
/**
......
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