Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Please create a folder "Dashboard" to hold the dashboard 's file like App.php or HomeDashboard.php the same like in the our dashboard-demo's src folder.
Please create an action in laravel controller, make sure it has GET and POST right. In this action, you will initiate the dashboard:
require_once "/path/to/Dashboard/App.php";
\demo\App::create()->run();
And that's all.
When i run the dashboard with the example code, i get an
ErrorException: Undefined index: in vendor/koolreport/dashboard/Application.php:220
I'm also using laravel.
In my controller i have,
public function dashboardReport()
{
$report = new App();
$report::create();
$report->run();
}
and in the app.php
class App extends \koolreport\dashboard\Application
{
protected function dashboards()
{
return [
"PaymentBoard"=> PaymentBoard::create()->icon("fa fa-home"),
];
}
}
the rest of the code is as is on the quick start example.
Here is full code:
//controller
public function dashboardReport()
{
App::create()->run();
}
//app.php
class App extends \koolreport\dashboard\Application
{
protected function dashboards()
{
return [
"PaymentBoard"=> PaymentBoard::create()->icon("fa fa-home"),
];
}
}
//paymentboard.php
use \koolreport\dashboard\Dashboard;
class PaymentBoard extends Dashboard
{
protected function widgets()
{
return [
PaymentTable::create(),
];
}
}
//paymenttable.php
class PaymentTable extends Table
{
protected function dataSource()
{
return AutoMaker::table("payments");
}
protected function fields()
{
return [
Date::create("paymentDate"),
Currency::create("amount")
->USD()
->symbol(),
];
}
}
//automaker.php
use koolreport\dashboard\sources\MySQL;
class AutoMaker extends MySQL
{
protected function connection()
{
return [
"connectionString" => "mysql:host=sampledb.koolreport.com;dbname=automaker",
"username" => "expusr",
"password" => "koolreport sampledb",
"charset" => "utf8"
];
}
}
//web.php
Route::get('/DashboardReport', 'ReportsController@dashboardReport');
also tried
Route::any('/DashboardReport', 'ReportsController@dashboardReport');
Thank you for posting your code, we found that our quick start code has a small bug so we have updated it
https://www.koolreport.com/docs/dashboard/quick_start/
Could you please try to copy the updated code to your code base one more time.
Please let me know if issue is gone.
By the way, we have a lot of example in our dashboard-demo that you may have a look.
Great news on Laravel CSRF, we have released new version of Dashboard (1.3.5) which will work with Laravel CSRF.
To make dashboard work with laravel csrf, you do like this in laravel controller
public function dashboardReport()
{
App::create()
->csrf(
\koolreport\dashboard\security\CSRF::create()
->token(function(){
return csrf_token();
})
)
->run();
}
Basically, you will create a CSRF object which token is created by laravel's token generated function csrf_token()
.
Hope that helps.
Really, hmm, let me inform dev.team. May I know your version of PHP and Laravel. We will test on the same version as you have.
Note: Please make sure you have install Dashboard 1.3.5 and important clear all folder "public\koolreport_assets" if there is. Please try to refresh Crtl + F5 as well since to make this work, it requires new javascript file, and sometime due to caching, the file is not updated.
Also, if possible, please open the console of browser and let me know if there is any error showing. If there is, please let me know.
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo