common/models/forms/Register.php
public function validateUsername( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			if( $this->userService->isExistByUsername( $this->username ) ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_USERNAME_EXIST ) );
			}
		}
	}
public function validateUsername( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			if( $this->userService->isExistByUsername( $this->username ) ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_USERNAME_EXIST ) );
			}
		}
	}
public function validateUsername ( $ attribute , $ params ) { if ( ! $ this -> hasErrors ( ) ) { if ( $ this -> userService -> isExistByUsername ( $ this -> username ) ) { $ this -> addError ( $ attribute , Yii :: $ app -> coreMessage -> getMessage ( CoreGlobal :: ERROR_USERNAME_EXIST ) ) ; } } }
Check whether the username is available.

@param string $attribute
@param array $params
Check whether the username is available .