How to login from different tables in Yii2

Comparing #2 with #3

Revision #3 was created by AndroideLP AndroideLP on Apr 3, 2018, 11:34:00 PM.

error in code tag

Content

[...]
```
My config/web.php

```php

 
'user' => [
'class'=>'yii\web\User',
'identityClass' => 'app\models\User',
[...]
],
```

 
Note for each there is a identifyClass and one view login.
Now, we need to create the models:
[...]
```php

//behaviors of the school
public function behaviors()
{
[...]
```php

 
<?php if (!\Yii::$app->scholl->isGuest):?>
<h1>My scholl Name: <?=\Yii::$app->scholl->identity->name?>
<?php endif;?>

<?php if (!\Yii::$app->teacher->isGuest):?>
<h1>Teacher Name: <?=\Yii::$app->teacher->identity->name?>
[...]