From 866f0a9f561c7fc93335b55c2728e52a6448a5e0 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 19 Mar 2024 11:58:49 -0700 Subject: [PATCH] syncs assets location to users location --- app/Console/Commands/LdapSync.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index a26c157476..34eb4642b3 100755 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -391,9 +391,11 @@ class LdapSync extends Command $user->location_id = $location->id; } } - $assets = Asset::whereColumn('assigned_to', '=', $user->id)->get(); + //updates assets location based on user's location + $assets = Asset::where('assigned_to', '=', $user->id)->get(); foreach($assets as $asset){ $asset->location_id = $user->location_id; + $asset->save(); } $user->ldap_import = 1;