KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

What is the best way to get current user in CustomBoard #3374

Closed Eugene opened this topic on on Nov 11 - 6 comments

Eugene commented on Nov 11

Hi, how to get user information?

I found this $this->board()->app()->user() in one of the topics but it does not work in my CustomBoard (in the class that extends CustomBoard) $this->app()->user() does not work as well

I use User::createFromSession()) to get user now but I am not sure is it correct or not.

PS: Guys, you have a great product. I know you're busy, but if you promise to respond within 24 hours, please make sure to do so. We genuinely need your assistance, and that’s one of the reasons we chose the Pro version. Some of my questions have been waiting over four days without any response.

KoolReport commented on Nov 11

Inside the class extended from CustomBoard, you should use $this->app()->user() asCustomBoard is actually derived from Dashboard class. Inside the view of CustomBoard, you use $this->board()->app()->user(). Since you said that it does not work, please post me some code so that I can try to replicate the case.

Eugene commented on Nov 11

Thanks for so fast answer.

Regarding your question.

I try to use $this->app()->user() in onCreated() method. I think this is the reason why it does not work.

Please suggest where better to prepare parameters for my view?

Eugene commented on Nov 11

I think onRendering is a correct place... and $this->app()->user() should work there

KoolReport commented on Nov 11

Let try on onInit() to see how. Also if you call the function inside action of CustomBoard, it will work.

KoolReport commented on Nov 11

onRendering is also fine, onCreated happned when CustomBoard is created but have not been linked to App class. After the onInit then you can access to Application class and the user.

Eugene commented on Nov 11

well. I got it. thank you :-)

Please have a look to 3370 and 3371 they made me stuck.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

Dashboard