daniel21gt
4 months ago

Problems with excel hosting reports. laravel 5.5

Posted 4 months ago by daniel21gt

How about, I have scheduled these reports that work very well locally,

this is, in that when I do a query for a different filter, I click on the button to download excel report, and this download what I have consulted without problems, but now that I upload everything to a hosting, it does not work anymore, because if I consult with different filters, whenever I download the excel I get the first result that I consult and not the following ones that I consult.

the strangest thing is that it only happens with google chrome, and not in other browsers, why did this happen?, Should I enable something in the hosting to avoid this behavior?

       <td style="width:20%;" border="0"> 
        
         @if(Auth::user()->hasRole('admin'))  
          <table style="width:100%;" border="0" >
             <tr><td style="width:50%;" border="0">           
                  <a href="{{ route('products.excelgobernadores') }}" class="btn btn-sm btn-primary">
                     Descargar reporte en Excel
                  </a>
             <td style="width:25%;" border="0"> 
        </table>
        @endif
        @if(Auth::user()->hasRole('gestion'))  
          <table style="width:100%;" border="0" >
             <tr><td style="width:50%;" border="0">           
                  <a href="{{ route('products.excelgobernadores') }}" class="btn btn-sm btn-primary">
                     Descargar reporte en Excel
                  </a>
             <td style="width:25%;" border="0"> 
        </table>
        @endif

Metod

if($registrado == 1)

    {

      $request->user()->authorizeRoles(['admin']);


        $urlgover = request()->headers->get('referer');
         parse_str(parse_url($urlgover)['query'], $output);
          $valorgober = $output['governore'];


        Excel::create('ExcelGobernadores', function($excelgobernadores) use ($valorgober){
            $excelgobernadores->sheet('Excelsheet', function($sheet) use ($valorgober){
    
              $conteogobe = usuarios::join('governor', 'usuarios.gobe_id', '=' , 'governor.idg')->where('gobe_id',$valorgober)->where('asignacion', '<>', '')->select('user_id', 'user_id', 'usuario_ad', 'nombre', 'apellido', 'cedula', 'telefonos', 'direccion', 'barrio', 'lugar_votacion', 'mesa_votacion', 'email', 'ciudad', 'comentario', 'asignacion', 'estado', 'governor.governor_candidate')->get();
              $conteogobe = json_decode( json_encode($conteogobe), true);
              $sheet->fromArray($conteogobe);
              $sheet->setOrientation('landscape');

           });

        })->export('xls');
    
   }

Please sign in or create an account to participate in this conversation.