Hi, I am trying to create a simple table using Laravel. I am new to KoolReport, but I've used it to create other reports. I've found a very few posts here about using KoolReport with Laravel, but they didn't help me solve my problem.
Here are my files:
--- \routes\web.php (routes file) ---
Route::get('/report/table', 'ReportsController@table');
--- \app\Http\Controllers\ReportsController.php ---
namespace App\Http\Controllers;
class ReportsController extends Controller
{
public function table()
{
$table = new \App\Reports\Table;
$table->run();
return view('table', compact('table'));
}
}
--- \app\Reports\Table.php ---
<?php
namespace App\Reports;
use koolreport\KoolReport;
//require_once dirname(__FILE__)."/../../vendor/koolreport/autoload.php"; // No need, if you install KoolReport through composer
class Table extends KoolReport
{
function settings()
{
return array(
"dataSources" => array(
"mydata" => array(
'connectionString' => 'pgsql:host=localhost;port=5500;dbname=tc'
,'username' => 'postgres'
,'password' => 'password'
)
)
);
}
function setup()
{
$this->src("mydata")
->query("select date(punch_timestamp) as punch_date, id_punch_type from punches")
->pipe($this->dataStore("punches"));
}
}
--- \resources\views\table.blade.php ---
<?php
use koolreport\widgets\koolphp\Table;
Table::create(array(
"dataStore" => $table->dataStore("punches")
));
?>
Here's the exception I keep receiving:
Undefined index: __ACTIVE_KOOLREPORT__ (View: /var/www/html/rpta/webapp/resources/views/table.blade.php)
in
/var/www/html/rpta/webapp/vendor/koolphp/koolreport/koolreport/core/Widget.php
public function __construct($params=null)
{
$this->params = $params;
$this->report = $GLOBALS["__ACTIVE_KOOLREPORT__"]; <--- this line is highlighted
$this->currentDir = dirname(Utility::getClassPath($this));
$this->name = Utility::get($this->params,"name");
When I follow the exception trace back a few files, it identifies file table.blade.php
/ Table::create
... commmand.
What am I missing?