Pass parameter in JasperPHP and Laravel

0

I have the following code in PHP under Laravel I need to pass the id of the invoice and the name of the account. but it does not work. it only allows me to send a single parameter in the array. if I remove the $ account-> name, it works perfect for me.

Error generated with 2 parameters Exception in JasperPHP.php line 187: Your report has failed and could not be worked! Try to output the command using the function output(); and run it manually in the console.

public function compilarFacturaOficina($grupo, $cabezera , $archivo ){
    $ruta = '/public/comprobantes/facturas/';        
    $archivoCompilado = 'Blank_A4';
    $user_id = Auth::user()->id;
    $cuenta = Cuenta::find($cabezera->cuenta_id);

    switch ($grupo) {
        case 9927:
            // Crear el objeto JasperPHP
            $jasper = new JasperPHP;
            //dd($factura_id);

            $jasper->process(
            base_path($ruta . $archivoCompilado),
            false,
            array('pdf', 'rtf', 'html' ,'xls'),
            array('factura_id' => $cabezera->id , 'cuenta' => $cuenta->nombre)
            )->execute();
            break;

        default:
            # code...
            break;
    }


}
    
asked by Juan Liang 07.09.2018 в 04:04
source

1 answer

0

I understand that maybe you should pass the values of the same array (you need the name of the element 'account' and the arrow):

array('factura_id' => $cabezera->id , 'cuenta' => $cuenta->nombre)
    
answered by 07.09.2018 в 10:10