Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Although I have not fully understood your question but I guess you are asking about accessing logined user information from Dashboard or widget. In any where, you always can access user information with:
$user = $this->app()->user();
$username = $user->name();
$id = $user->id();
$roles = $user->roles();
<?php
namespace space;
use \koolreport\dashboard\widgets\Table;
class GraphicTable extends Table {
protected function dataSource()
{
return
//Code Koolreport .dev
$user = $this->App()->User();
$username = $user->name();
$id = $user->id();
$roles = $user->roles();
echo = $roles
}
}
<?php
namespace space;
use \koolreport\dashboard\widgets\Table;
class GraphicTable extends Table
{
protected function dataSource()
{
return ConnectDB::table("users")
->select("username");
//---> Because of return in above line, the code below never run <--
//Code Koolreport .dev
$user = $this->App()->User(); // --> it should be $this->app()->user()
$username = $user->name();
$id = $user->id();
$roles = $user->roles();
}
}
<?php
namespace space;
use \koolreport\dashboard\widgets\Table;
class GraphicTable extends Table
{
protected function dataSource()
{
return
//Code Koolreport .dev
$user = $this->App()->User();
$username = $user->name();
$id = $user->id();
$roles = $user->roles();
echo = $roles
}
}
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo