Revision #4 has been created by AndroideLP on Apr 3, 2018, 11:35:03 PM with the memo:
error code php
« previous (#3) next (#5) »
Changes
Title
unchanged
How to login from different tables in Yii2
Category
unchanged
How-tos
Yii version
unchanged
2.0
Tags
unchanged
authentication,login,different table name,multiple login
Content
changed
The Problem:
Yii2 utilizes by default UserIdentity configured in config/web.php for connection, this object appy one table to authentication ('identityClass' => 'app\painel\models\User'). How to authentication from diferent tables?
Solution:
Create instances in web.php to uses UserIdentify.
eg:
```php
$user = \Yii::$app->user;
$school = \Yii::$app->school;
$teacher = \Yii::$app->teacher;
```
My config/web.php
```php
'user' => [
'class'=>'yii\web\User',[...]