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