KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Laravel CSRF Proteccion on PivotMatrix #1024

Open Luis Rubén González Cuevas opened this topic on on Aug 1, 2019 - 1 comments

Luis Rubén González Cuevas commented on Aug 1, 2019

Hi I've an issue with PivotMatrix, when i use the attribute 'partialProcessing' => true, and try to expand the Pivot Matrix, appear an 419 error code in reference to the Larave's CSRF proteccion error.

I Try to resolve including this code

"scope" =>  array(
        "_token" => csrf_token(),
    ),

but, it reload the page and it's not functional to my product.

Controller
$consulta =$this->src('source')->query($query)
                    ->params(array(
                        ":fecha_ini"=>$fecha_ini,
                        ":fecha_fin"=>$fecha_fin,
                    ))
                    ->pipe(new ColumnMeta(array(
                        'cargo'=>array(
                            'type' => 'number',
                            'prefix' => '$',
                            'decimals'=>2,
                        ),
                    )))
                    ->pipe(new Pivot(array(
                        "dimensions"=>array(
                            "column"=>"tipo",
                            "row" => "cuenta, estacion, semana, cargo",
                        ),
                        "aggregates"=>array(
                            "sum"=>"cargo",
                        ),
                        'partialProcessing' => true,
                    )))
                    ->pipe($this->dataStore('polizs'));


View:

$dataStore = $this->dataStore('polizs');

    if($dataStore->countData() > 0){
        PivotMatrix::create(array(
            "dataStore" => $dataStore,
            "id" => "pivotMatrix1",
            "columnCollapseLevels" => array(0),
            "rowCollapseLevels" => array(0,1,2),
            "rowSort" => array(
                'cuenta' => 'asc'
            ),
            'width' => '100%',
            'totalName' => 'Total',
            'headerMap' => array(
                "cuenta" => 'Cuenta',
                "estacion" => 'Estación',
                "semana" => 'Semana',
            ),
            'paging' => array(
                'size' => 20,
                'maxDisplayedPages' => 5,
                'sizeSelect' => array(20, 50, 100, 500)
            ),
        ));

Help me! Please!!!

Best Regards Luis Montes

David Winterburn commented on Aug 1, 2019

Hi Luis,

I think the solution:

"scope" =>  array(
        "_token" => csrf_token(),
    ),

works fine for PivotMatrix in Laravel. Would you please tell us more about what you meant by "it reload the page and it's not functional to my product"? Thanks!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Pivot