Commit 361c57f2 authored by Nicolas Widart's avatar Nicolas Widart

Merge branch 'master' of github.com:nWidart-Modules/User

* 'master' of github.com:nWidart-Modules/User:
  Check for empty roles on store and update
  Fix the redirection on delete of a user
  Adding gitignore
parents 0255f284 95c64d28
...@@ -121,7 +121,7 @@ class UserController extends AdminBaseController ...@@ -121,7 +121,7 @@ class UserController extends AdminBaseController
$this->user->delete($id); $this->user->delete($id);
Flash::success('User deleted'); Flash::success('User deleted');
return Redirect::to('users'); return Redirect::route('dashboard.user.index');
} }
} }
\ No newline at end of file
...@@ -49,7 +49,9 @@ class SentinelUserRepository implements UserRepository ...@@ -49,7 +49,9 @@ class SentinelUserRepository implements UserRepository
public function createWithRoles($data, $roles) public function createWithRoles($data, $roles)
{ {
$user = $this->user->create($data); $user = $this->user->create($data);
$user->roles()->attach($roles); if (!empty($roles)) {
$user->roles()->attach($roles);
}
$code = Activation::create($user); $code = Activation::create($user);
Activation::complete($user, $code); Activation::complete($user, $code);
...@@ -90,7 +92,9 @@ class SentinelUserRepository implements UserRepository ...@@ -90,7 +92,9 @@ class SentinelUserRepository implements UserRepository
$user = $user->fill($data); $user = $user->fill($data);
$user->save(); $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