jeudi 29 août 2019

How do I generate multiple pdf files

I want to generate several pdf files just by clicking on a button, but all the time, it's a single file that generates as the return statement stops the function.

Any help will be appreciated. Thanks

public function printPDF()
    {
        $fiches = FichePaiesInfos::where('user_id', Auth::user()->id)->get();

        foreach ($fiches as $fiche) {
            $data = [
                'name' => $fiche->personnelsInfos->name,
                'firstname' => $fiche->personnelsInfos->firstname,
                'fiche' => $fiche
            ];
            $pdf = PDF::loadView('layouts.pdf_view', $data);
        }
        return $pdf->download('fiche' . '_' . time() . '.pdf');;
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire