TName #

TName trait allows object to get or set name with name() method. The Dashboard and Widget are implemented this trait.


class MyClass
    use \koolreport\dashboard\TName;

$obj = new MyClass();
echo $obj->name();
// Output "MyClass"

$obj->name("this is my class");
echo $obj->name();
//Output "this is my class"

TProps #

TProps facilitate object to get/set property for an object.


// Example of using object with TProps trait


echo $object->hidden(); //true
echo $object->width(); //1/2
echo $object->cssClass(); //bold

Methods #

When TProps is implemented in an object, object has below methods

props(array $list)Set the properties available, $list is an associate array with name of property and its default value
props()arrayUsing props() without parameter will return the list of properties in associate array
hasProp(string $propName)Return true if the property is existed
removeProps(array $list)Remove some properties, for example ->removeProps(["width","height"])
getProp(string $name)mixedGet value of a property
extractProps(array $list)arrayGet list of some properties, for example ->extractProps(["width","height"])


use \koolreport\dashboard\TProps;
use \koolreport\dashboard\TConstructServices;

class MyClass
    use TProps;
    use TConstructServices;

    public function __construct()


$obj = new MyClass;


echo $obj->width(); //240
echo $obj->color(); //"blue"

echo $obj->getProp("width"); //240
echo json_encode ($object->extractProps(["width","height"])); // {"width":240,"height":360}

echo $obj->hasProp("width")?"yes":"no"; // "yes"

$object->removeProps(["width","height"]); // Now there is only "color" property

TAppLink trait contains app() function which allows get/set the application object. Dashboard, Widget, Request are implemented this trait.


$this->app(); //Get the app object

$this->app($app); //Set the app object

TDashboardLink trait contains dashboard() function which allows get/set the dashboard object. Widget is implemented this trait.


$this->dashboard(); //Get the dashboard object

$this->dashboard($dashboard); //Set the dashboard object

TWidgetLink trait contains widget() function which allows get/set the widget object. Field is implemented this trait.


$this->widget(); //Get the widget object

$this->widget($widget); //Set the dashboard object

TParams #

TParams provides params() method to object. Dashboard and Widget are implemented this trait.


//Set parameters

$this->params(); //Get all params

$this->params("year"); // Get only year parameter

TEnabledPermit #

TEnabledPermit provides methods enabled() and enabledWhen() method to object. Dashboard, Widget and Field are implemented this trait.

enabled() #

Get or set the availability of object


$this->enabled(false); // Disable the object

// Set by function
$this->enabled(function($request) {
    return $request->user()->hasRole("admin");

// Get status
$enabled = $this->enabled();

enabledWhen() #

If your application is provided with Permit object then you can use enabledWhen()



//The "beAdmin" is define like this

class Permit extends \koolreport\dashboard\Permit
    protected function beAdmin($request, $sender)
        return $request->user()->hasRole("admin");

//The Permit will be provided to Application like this:

class App extends \koolreport\dashboard\Application
    protected function permission()
        return Permit::create();

Get started with KoolReport

KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.