From d84366c6c50cd296a273a9a4d634942ee15e9b18 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 19 Sep 2018 17:24:29 -0700 Subject: [PATCH] Add empty array to groups if none filled in --- app/Http/Controllers/Api/UsersController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index dca2e9e4f4..7fca6bf3af 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -203,6 +203,8 @@ class UsersController extends Controller if ($user->save()) { if ($request->filled('groups')) { $user->groups()->sync($request->input('groups')); + } else { + $user->groups()->sync(array()); } return response()->json(Helper::formatStandardApiResponse('success', (new UsersTransformer)->transformUser($user), trans('admin/users/message.success.create'))); }