preview a document in laravel

0

I have a list of files that is in the Mysql database, it is shown as a list and it gives me the names of the files that are in it, for example my view that is a table with the list of all the documents. or txt or pdf or png or jpg that can be uploaded, that by clicking on the id}} "open another window with the document that you select, see on the page,

this is the view

 <div id="clientes" class="tipos">
    <div class="tablaarchivo{{$arch->fecha}}" id="idarchivoescondido">
    <div class="scroll" style="height:40%; width: 100% ; top: 8%; overflow: auto;">
     <table class="table table-bordered table-striped " style="height: 40%; width: 100%; top: 2%; ">
       <tbody style="height: 100%; width: 100%; top: 100%; border: none;">
         @foreach($archivos as $arch)
         <tr id="file{{$arch->id}}">
           <td><input type="checkbox" class="valor" id="{{$arch->id}}" value="{{$arch->id}}" name="checkName[]"></td>
           <td>{{$arch->name}}</td>
           <td>{{$arch->fecha}}</td>
           <td><a name="name" href="/ver/{{$arch->id}}" target="_blank" ><img src="/images/ojo.png" title="visualizar"></a></td>
         </tr>

         @endforeach
       </tbody>
     </table> 
    </div>
  </div>
</div> 

this is the route

Route :: get ('/ ver / {id}', 'GroupClientsController @ VERAfile');

This is the method you see and tried with several things but I could not find a preview method that works if you could help me with this would be super cool

 public function VERArchivo($id){

  $muestra =  File::find($id);
     $file =  new File();


  // $pdf = ('whateveryourviewname', $name);
  echo($muestra->name);
  die(' 
       ====auiq');
        // $dompdf = new Dompdf();
      // $dompdf->loadHtml($name);

// (Optional) Setup the paper size and orientation           // $ dompdf-> setPaper ('A4', 'landscape');

// Render the HTML as PDF          // $ dompdf-> render ();

// Output the generated PDF to Browser           // $ dompdf-> stream ();        // $ file = File :: findOrFail ($ name);        // $ text = file_get_contents ($ file);        // $ text = nl2br ($ text);        // $ open = PDF_open_file ($ text, $ file);

   // return view('/clientgroup/Visualizar', compact(['abrir']));

}
    
asked by Ricardo Rojas 05.12.2018 в 21:01
source

0 answers