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.
2 parents d0d300b + 85e36c4 commit cdf4fcdCopy full SHA for cdf4fcd
src/Console/CleanEmails.php
@@ -20,7 +20,14 @@ public function handle()
20
21
$cutOffDate = Carbon::now()->subDay($maxAgeInDays)->format('Y-m-d H:i:s');
22
23
- $amountDeleted = InboundEmail::where('created_at', '<', $cutOffDate)->delete();
+ /** @var InboundEmail $modelClass */
24
+ $modelClass = config('mailbox.model');
25
+
26
+ $models = $modelClass::where('created_at', '<', $cutOffDate)->get();
27
28
+ $models->each->delete();
29
30
+ $amountDeleted = $models->count();
31
32
$this->info("Deleted {$amountDeleted} record(s) from the Mailbox logs.");
33
0 commit comments