replaced for loop with eloquent query update

This commit is contained in:
Godfrey M 2024-03-21 14:34:47 -07:00
parent 866f0a9f56
commit c62a022252

View file

@ -392,11 +392,7 @@ class LdapSync extends Command
}
}
//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();
}
Asset::where('assigned_to', '=', $user->id)->update(['location_id' => $user->location_id]);
$user->ldap_import = 1;