Request & Response

You may have encountered many times the $request and $response parameter in action of Application, Page, Dashboard or Widget. So this article helps you understand these two objects.

Request #

Methods #

Namedescription
$request->route()Return the route that request is targeted to reach
$request->action()Return the action name needs to be run
$request->params()Return all parameters of request in form of associate array
$request->params(string $name)Return specific value of a parameter inside list of parameters
$request->user()Return current user
$request->app()Return the application

Response #

updatePanel() #

$response->updatePanel(string $name, string $content[, string $effect]);

Update the content of given name panel. $effect is optional and can be set to "none", "fade".

Example:

class MyTable extends Table
{
    protected function actionCrazy($request, $response)
    {
        $response->updatePanel($this->name(),"Show crazy text","none");
    }
}

runScript() #

$response->runScript(string $script);

Run a javascript at client-side

Example:

class MyTable extends Table
{
    protected function actionCrazy($request, $response)
    {
        $response->runScript("alert('crazy')");
    }
}

clear() #

$response->clear()

Clear all previous response

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.