vendredi 27 mars 2020

How to download file when function in queue in laravel?

I have two function first get files and second make zip file and download it. I make jobs for both of these functions queue is working correct. it is making zip file not downloading it. i think because it is in queue . here i am posting second function which is in queue

queue

 Consignment::withChain([
      new ConsignmentDownload($id)
  ])->dispatch($id);

in ConsignmentDownload here is function consignmentDownload

 public static function consignmentDownload($id)
  {

    $manifestId = $id;
    $manifests =  Manifest::find($manifestId);
    $zipper = new \Chumper\Zipper\Zipper;

    $path = public_path('manifest_pdfs/manifest_' . $manifestId);

    foreach ($manifests->consignments as $allConsignment) {

      $filepath = $path . '/cosignment_' . $allConsignment->id . '_pod.pdf';

      //add/create pdf zip 
      $zipper->make($path . '/manifest_' . $manifestId. '.zip')->add($filepath);
    }

    $zipper->close();


    return response()->download($path . '/manifest_' . $manifestId . '.zip');

  }

return response()->download is not working i want to download that zip file.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2JjZB8U
via IFTTT

Aucun commentaire:

Enregistrer un commentaire