Add empty array to groups if none filled in

This commit is contained in:
snipe 2018-09-19 17:24:29 -07:00
parent b692f67779
commit d84366c6c5

View file

@ -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')));
}