json(['message' => 'Still working.....'], 409); } if($report) { Cache::forget($hash); $headers = [ 'Content-Disposition' => 'attachment', 'Content-Type' => 'text/csv', ]; return response()->streamDownload(function () use ($report) { echo $report; }, $this->filename, $headers); } } }