Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public function safeUp() |
||
12 | { |
||
13 | $now = time(); |
||
14 | $columns = [ |
||
15 | 'username', 'first_name', 'last_name', |
||
16 | 'auth_key', 'password_hash', 'password_reset_token', 'email', |
||
17 | 'status', 'create_time', 'update_time', |
||
18 | ]; |
||
19 | $rows = [ |
||
20 | [ |
||
21 | 'Admin', 'Foo', 'Bar', |
||
22 | '', Yii::$app->getSecurity()->generatePasswordHash('123456'), '', '[email protected]', |
||
23 | StatusInterface::STATUS_ACTIVE, $now, $now, |
||
24 | ], |
||
25 | ]; |
||
26 | $this->batchInsert(User::tableName(), $columns, $rows); |
||
27 | |||
28 | $auth = Yii::$app->getAuthManager(); |
||
29 | $auth->assign($auth->getRole('Administrator'), 1); |
||
30 | } |
||
37 |