map(function (string $class) { $class::onlyTrashed()->each(function ($model) { // Delete model if it has been deleted for more than 30 days. $date = Carbon::now()->subDays(30); if ($model->deleted_at->lt($date)) { $model->forceDelete(); } }); }); } }