diff --git a/skolehjem/app/Http/Controllers/UserController.php b/skolehjem/app/Http/Controllers/UserController.php index d39c252..6a0ce84 100644 --- a/skolehjem/app/Http/Controllers/UserController.php +++ b/skolehjem/app/Http/Controllers/UserController.php @@ -153,11 +153,13 @@ class UserController extends Controller /** @var User $user */ $user->update($data); - $user->roles()->detach(); - $user->forgetCachedPermissions(); + if ($request->roles != null) { + $user->roles()->detach(); + $user->forgetCachedPermissions(); - foreach ($request->roles as $role){ - $user->assignRole($role); + foreach ($request->roles as $role){ + $user->assignRole($role); + } } $user->save(); @@ -246,4 +248,9 @@ class UserController extends Controller { return Response::detect("users.edit"); } + + public function accounteditpass() + { + return Response::detect("users.editpass"); + } } diff --git a/skolehjem/resources/views/app/users/account.blade.php b/skolehjem/resources/views/app/users/account.blade.php index 1572b8f..0d6d374 100644 --- a/skolehjem/resources/views/app/users/account.blade.php +++ b/skolehjem/resources/views/app/users/account.blade.php @@ -11,5 +11,6 @@