index.php
<?php
namespace App\Reports;
// require_once dirname(__FILE__)."/../../vendor/koolreport/autoload.php"; // No need, if you install KoolReport through composer
class report1 extends \koolreport\KoolReport
{
use \koolreport\laravel\Friendship;
use \koolreport\clients\Bootstrap;
protected function settings()
{
return array(
"dataSources"=>array(
"ejinayat_v4"=>array(
"connectionString"=>"mysql:host=localhost;dbname=ejinayat_v4",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
)
)
);
}
// By adding above statement, you have claim the friendship between two frameworks
// As a result, this report will be able to accessed all databases of Laravel
// There are no need to define the settings() function anymore
// while you can do so if you have other datasources rather than those
// defined in Laravel.
//Setup report
protected function setup(){
$this->src("ejinayat_v4")
->query("
SELECT reference_number,description,status_id,process_id FROM b5_firs
ORDER BY status_id")
// ->params(array(":status_id"<="1"))
->pipe($this->dataStore("result"));
$this->src("ejinayat_v4")
->query("
SELECT b5_firs.reference_number, b5_firs.process_id, statuses.name FROM statuses
JOIN statuses ON b5_firs.status_id = statuses.id
")
->pipe($this->dataStore("total"));
}
}