where('created_at', '<', now()->subDay())->get(); foreach ($stale as $zipDownload) { if ($zipDownload->path !== null) { Storage::disk('files')->delete($zipDownload->path); } $zipDownload->delete(); } $this->info("Purged {$stale->count()} stale zip download(s)."); return self::SUCCESS; } }