return statement is not allowed in batch success call Queue laravel.
In this code, first I generate and store the csv file in the public/csv folder, and on success, I try to download that file, but I cannot. In the log file, there is a log, and I think the return statement is not allowed. Can anyone help me figure out my issues?
My controller dispatch call:
$batch = Bus::batch([new ProcessReport,])->allowFailures()->onConnection('database')->onQueue('report')->then(function(\Illuminate\Bus\Batch $batch) {\Log::info('Batch ' . $batch->id . ' finished successfully!');$file_path = public_path() . DIRECTORY_SEPARATOR . 'csv' . DIRECTORY_SEPARATOR . 'report.csv';$headers = ['Content-Type' => 'text/csv','Content-Disposition' => 'attachment; filename=report.csv',];\Log::info('File path ' . $file_path);return Response::download($file_path, 'report.csv', $headers);})->catch(function (Batch $batch,\Exception $e) {\Log::error("Error ".$e->getMessage());})->finally(function(\Illuminate\Bus\Batch $batch) {\Log::info('Cleaning leftovers from batch ' . $batch->id);})->dispatch();