Show data from specific user in database

Hello guys !

I am new to yii. I made my protected page where only logged in users can see it. I have 2 questions.

  1. How can i redirect the logged in user to the user page ( the protected page i mentioned)?

  2. How can i show data from my database only for the specific user? i have a table on my database where in every row i have a client_id and its the same as the username id from the table "users" in my db. I have made this in php but i dont how to do it in yii with the built-in authentication system.


  1. Do Yii::$app->user->setReturnUrl(Url::to([‘user/view’, ‘id’ => x])) right before logging user in.

  2. Add client_id = x to your data queries.