Home  >  Article  >  Backend Development  >  Introduction to the method of modifying the built-in user table to other tables in Yii2.0

Introduction to the method of modifying the built-in user table to other tables in Yii2.0

巴扎黑
巴扎黑Original
2017-08-06 16:15:501259browse

For some reason, I don’t want to use the user table that comes with Yii. I want to use the admin database table I built myself. How to modify it? The editor below will introduce to you how to modify the user table that comes with yii2.0 to other tables. Let’s take a look.

For some reason, I don’t want to use the user table that comes with yii. I want to use my own Create the admin database table and modify it as follows:

1. Refer to common\models\User ModifyAdmin

2 in the advanced template. Modify


'user' => [ 
      //'identityClass' => 'common\models\User', 
      'identityClass' => 'common\models\Admin', 
      'enableAutoLogin' => true,

3 in the configuration file. Modify LoginForm getUser() to get the user from the admin table

The above is the detailed content of Introduction to the method of modifying the built-in user table to other tables in Yii2.0. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn