Login from more tables


I need a help. I have three tables (admin, teacher, student) and I want to log in them from one login form. And I need also distinguish them as roles that for example student can’t go to some page as teacher. How could I do that? Thank you for help!

Hello, maybe your tables can be interpreted as roles.

If so take a look at:


I created three radio buttons for every table in login form. Like * admin * teacher * student. With using this:

<?= $form->field($model, 'role')->inline()->radioList(array(1 => 'admin',2 => 'teacher',3 =>'student'))->label('You are: ');  ?>

How can I make to find and log in the user when the user put there username and password and click on one from the radio buttons who he is? I generated three models for each table with using gii. So what and where I must write to make it work?