Hi,
I'm trying to build a simple report with a table but I'm getting the following error:
Call to a member function source() on null (View: [path]/report.blade.php)
This is how I'm calling the report in the view(report.blade.php):
<?php
$report = new ListReport(array(
"data" => $model->data,
"columns" => $model->columns
));
$report->run()->render();
?>
As you can see the data was already fetched from database and passed as an array, as well the columns.
The ListReport
class:
<?php
namespace App\Reports;
use \koolreport\widgets\koolphp\Table;
class ListReport extends BaseReport
{
public function settings()
{
return array(
"dataSources" => array(
"data" => array(
"class" => '\koolreport\datasources\ArrayDataSource',
"data" => $this->params["data"],
"dataFormat" => "table",
)
)
);
}
protected function setup()
{
$this
->src('data')
->pipe(Table::create(
array(
"dataSource" => $this->params["data"],
"columns" => $this->params["columns"]
)
));
}
}
And the BaseReport
class:
<?php
namespace App\Reports;
use \koolreport\KoolReport;
class BaseReport extends KoolReport
{
use \koolreport\export\Exportable;
}
The point here is that I don't call source()
anywhere in my code, so it seems to be something internal. Maybe something I'm not setting properly.
I am following this example. Thanks in advance.