Skip to content

A free open source IT asset/license management system

replaced for loop with eloquent query update

Godfrey Mc62a022252b8
diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php
index 34eb4642b3..7fcbc8eb07 100755
--- a/app/Console/Commands/LdapSync.php
+++ b/app/Console/Commands/LdapSync.php
@@ -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;