*/ public function backoff(): array { return [10, 30, 60, 300]; } public function handle( Mailer $mailer, StorageService $storageService, PrivateS3Disk $privateS3Disk, ): void { $mailer->to(new Address($this->recipientEmail, $this->recipientName)) ->send(new SendContactMail($this->data)); $this->cleanupAttachment($storageService, $privateS3Disk); } public function failed(\Throwable $exception): void { $this->cleanupAttachment( app()->make(StorageService::class), app()->make(PrivateS3Disk::class), ); } private function cleanupAttachment( StorageService $storageService, PrivateS3Disk $privateS3Disk, ): void { if ($this->data->file === null) { return; } $filePath = new StorageFilePath($this->data->file->path); if ($storageService->fileExistsOnDisk($filePath, $privateS3Disk->disk)) { $storageService->removeFromDisk($filePath, $privateS3Disk->disk); } } }