Answer the question
In order to leave comments, you need to log in
What data does $app->user->identity store?
Good afternoon.
There is such a table
With the help of $app->user->idendity I can pull out the fields id, name, password, email
How to pull out the rest?
Or each time to make a request to the table, but this is not very rational.
Answer the question
In order to leave comments, you need to log in
Everything that is in the user model is there. But I don’t see a problem to check it myself, for clarity, for example, like this:
<pre>
<?php print_r(Yii::$app->user->idendity); ?>
</pre>
Goodnight.
For example, the money field.
But it is better to leave the data for authorization, tokens and other service information in the table, and move the detailed information about the user to another table, name it, for example, profile and link it to the first table by user id.
In the profile model
public function getUser()
{
return $this->hasOne(User::className(), ['id' => 'id_user']);
}
public function getProfile()
{
return $this->hasOne(Profile::className(), ['id_user' => 'id']);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question