We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d5da44 commit e69ad08Copy full SHA for e69ad08
src/Console/CleanEmails.php
@@ -37,12 +37,9 @@ public function handle()
37
38
$modelClass::where('created_at', '<', $cutOffDate)
39
->select('id')
40
- ->chunk(100, function ($models) use ($modelClass) {
41
- foreach ($models as $model) {
42
- $modelInstance = $modelClass::find($model->id);
43
- $modelInstance->delete();
44
- $this->amountDeleted++;
45
- }
+ ->eachById(count: 100, callback: function ($model) {
+ $model->delete();
+ $this->amountDeleted++;
46
});
47
48
$this->info("Deleted {$this->amountDeleted} record(s) from the Mailbox logs.");
0 commit comments