jeudi 29 novembre 2018

Dompdf LoadView variable passing

i can't load able to pass a parameter to the dompdf function LoadView.

this is my controller:

  public function pst_affluiti(){

    $data=DB::all('Anagrafica')->get();
    $pdf = PDF::loadView('output',['data' => $data]);
  return $pdf->stream('output.pdf');
  }

my output.blade.php

<body>
 <div class="container">
<table class="table table-sm table-bordered" >
  <thead>
    <tr>
      <th scope="col-sm-1 col-6">Data Affl.</th>
      <th scope="col-sm-2">Cron.</th>
      <th scope="col-sm-2">Cognome</th>
      <th scope="col-sm-2">Nome</th>
      <th scope="col-sm-2">Data nac.</th>
    </tr>   
  </thead>
 <tbody>
        @foreach($data as $row)
            <tr>
               <td></td>
               <td></td>
               <td></td>
               <td></td>
            </tr>
           @endforeach 
         </tbody>
</table>
</div>
</body>

if i load a normal view of my query it works well.

Any suggest? Thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire