milkeshp00433068
milkeshp00433068

I am working on making a form where the logged in user can write a text message and it gets saved to backend. Now the problem is I can't get to think as to how can I leverage and use the RainLab.User plug-in to get the logged in user and pass into my database model, the details of text message associated with that user.

Someone please help me and guide me.

Thanks.

Adrien - ACTE Solutions
Adrien - ACTE Solutions

Hello, You can get loggedIn user like below and add it in your component, controller or model. Extract from RainLab.User documentation.

The Auth::check method is a quick way to check if the user is signed in.
// Returns true if signed in.
$loggedIn = Auth::check();

To return the user model that is signed in, use Auth::getUser instead.
// Returns the signed in user
$user = Auth::getUser();

1-2 of 2