0

I want to use table login_info instead of table user in yii2 to create member activities in frontend part that are not in the backend part. Also I have roles at the table login_info like :health-post, hospital, fchv, etc, not can be managed from user_id but can manage from user_name . Do you have in any idea in yii2.

Bloodhound
  • 2,906
  • 11
  • 37
  • 71
Bishwa Timilsina
  • 1,053
  • 9
  • 11

1 Answers1

0

If you want change only the tablename (and the schema of the table is like the yii user table ) you can easily (re)define the function tableName in your

frontend\models User.php eg: this way

namespace frontend\models;

use yii\models\web\User as BaseUser;

class User extends BaseUser
{
    public static function tableName()
    {
        return  'yuor_table_user';
    }
}

But if you want define a your User component based on your specific features you should create a new proper User class that implement the Identity interface You can see the the authentication - security guide , the user interface and the yii user class for reference and sample

Is not a simple job.

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107