vendredi 1 décembre 2017

Return PDF and Redirect in Laravel

I would like that, in a Laravel Controller, when I finish a method, it download a pdf and redirect to other route.

       $pdf = PDF::loadHTML($html)
          ->setPaper('a4', 'landscape')
          ->setWarnings(false);
          return $pdf->download('deposit.pdf');

       return redirect()->route('devices.index');

If I put return in PDF, the method not redirect. If I remove "return", the PDF does not download. I tried the code below but it not working.

      return redirect()->response()->download($pdf)->route('devices.index');



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

Aucun commentaire:

Enregistrer un commentaire