diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 362e9c7141..22f0acc25c 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -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'))); diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 354fd17765..e592d3b02d 100755 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -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')) {