public static function updateLastVisit($event)
    {
        if ($event->isValid) {
            /**
             * @var User $user
             */
            $user = $event->identity;
            $user->last_visit_at = time();
            $user->updateAttributes(['last_visit_at']);
            return true;
        }
        return false;
    }
public static function updateLastVisit($event)
    {
        if ($event->isValid) {
            /**
             * @var User $user
             */
            $user = $event->identity;
            $user->last_visit_at = time();
            $user->updateAttributes(['last_visit_at']);
            return true;
        }
        return false;
    }
public static function updateLastVisit ( $ event ) { if ( $ event -> isValid ) { /**
             * @var User $user
             */ $ user = $ event -> identity ; $ user -> last_visit_at = time ( ) ; $ user -> updateAttributes ( [ 'last_visit_at' ] ) ; return true ; } return false ; }
Update last visit time event handler


in user component:
'on afterLogin'   => ['maddoger\user\common\models\User', 'updateLastVisit'],
'on afterLogout'  => ['maddoger\user\common\models\User', 'updateLastVisit'],
@param $event
@return bool
Update last visit time event handler