Code Rules

Overview #

There are some code patterns that you see a lot in Dashboard. Understand this code pattern will help you to be more productive in coding.

Get Set #

Many Dashboard components implement TProps trait which allows those components to have this get and set code rule. You can set the properties by assign value into first parameter, for example we have hidden property, you can set its property like following

$object->hidden(true);

The hidden will be set to true, the method will return $object so that you can continue to set another property:

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

To retrieve the value from property, you simply call method without parameter:

$isHidden = $object->hidden(); //Return true, because we set it to true earlier.

Example:

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

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

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.