When I use yii\filters\auth\HttpBasicAuth,
I want to custom public $auth
which is @var callable,
but how to define it with below code?
* The following code is a typical implementation of this callable:
*
* ```php
* function ($username, $password) {
* return \app\models\User::findOne([
* 'username' => $username,
* 'password' => $password,
* ]);
* }
* ```
why can’t I define it like this (error report):
public $auth=function ($username, $password) {
return \app\models\User2::findOne([
'username' => $username,
'password_hash' => $password,
]);