Hello. I want save user last login date, so I decided to do it in event. Creating own event and attaching it to function saving timestamp is easy, just follow http://stackoverflow.com/questions/28575636/how-to-use-events-in-yii2 But I would prefer using built-in yii\web\user::EVENT_AFTER_LOGIN. This is my code:
class User extends ActiveRecord implements IdentityInterface {
public function init(){
$this->on(User::EVENT_AFTER_LOGIN, [$this, 'updateLastLogin']);
}
I am getting error: Undefined class constant ‘EVENT_AFTER_LOGIN’. I also tried IdentityInterface::EVENT_AFTER_LOGIN, but they both seem not be connected with yii\web\user. What is proper way to use this event?