T
T
teodor7teodor72021-08-16 19:46:46
Yii
teodor7teodor7, 2021-08-16 19:46:46

How to put the login and password from the User model in Yii2 into a separate file?

Here I look basicly from the box here the login and password are registered

public $authKey;
    public $accessToken;

    private static $users = [
        '100' => [
            'id' => '100',
            'username' => 'admin',
            'password' => 'admin',
            'authKey' => 'test100key',
            'accessToken' => '100-token',
        ],
        '101' => [
            'id' => '101',
            'username' => 'demo',
            'password' => 'demo',
            'authKey' => 'test101key',
            'accessToken' => '101-token',
        ],
    ];

https://github.com/yiisoft/yii2-app-basic/blob/mas...

This is not very convenient. I wanted to put it in params. But when calling Yii::$app->params['user'] it throws an error.
Who solved this problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question