mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Add empty array to groups if none filled in
This commit is contained in:
parent
b692f67779
commit
d84366c6c5
|
@ -203,6 +203,8 @@ class UsersController extends Controller
|
||||||
if ($user->save()) {
|
if ($user->save()) {
|
||||||
if ($request->filled('groups')) {
|
if ($request->filled('groups')) {
|
||||||
$user->groups()->sync($request->input('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')));
|
return response()->json(Helper::formatStandardApiResponse('success', (new UsersTransformer)->transformUser($user), trans('admin/users/message.success.create')));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue