Skip to content

Commit c62a022

Browse files
committed
replaced for loop with eloquent query update
1 parent 866f0a9 commit c62a022

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

app/Console/Commands/LdapSync.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,7 @@ public function handle()
392392
}
393393
}
394394
//updates assets location based on user's location
395-
$assets = Asset::where('assigned_to', '=', $user->id)->get();
396-
foreach($assets as $asset){
397-
$asset->location_id = $user->location_id;
398-
$asset->save();
399-
}
395+
Asset::where('assigned_to', '=', $user->id)->update(['location_id' => $user->location_id]);
400396

401397
$user->ldap_import = 1;
402398

0 commit comments

Comments
 (0)