Fixed updating the assigned assets location if user’s location changes

This commit is contained in:
snipe 2017-10-30 19:33:52 -07:00
parent 7f1b962e56
commit 546c3e50fa
2 changed files with 6 additions and 0 deletions

View file

@ -229,6 +229,9 @@ class UsersController extends Controller
$user->password = bcrypt($request->input('password'));
}
// Update the location of any assets checked out to this user
Asset::where('assigned_type', User::class)
->where('assigned_to', $user->id)->update(['location_id' => $request->input('location_id', null)]);
if ($user->save()) {
return response()->json(Helper::formatStandardApiResponse('success', (new UsersTransformer)->transformUser($user), trans('admin/users/message.success.update')));

View file

@ -331,6 +331,9 @@ class UsersController extends Controller
$user->zip = $request->input('zip', null);
// Update the location of any assets checked out to this user
Asset::where('assigned_type', User::class)
->where('assigned_to', $user->id)->update(['location_id' => $request->input('location_id', null)]);
// Do we want to update the user password?
if ($request->has('password')) {