Commit 2719bafd authored by Shakarim Sapa's avatar Shakarim Sapa

- Added new validation rule

parent 922cf48e
...@@ -186,6 +186,9 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter ...@@ -186,6 +186,9 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
self::SCENARIO_CHANGE_PASSWORD, self::SCENARIO_CHANGE_PASSWORD,
self::SCENARIO_CREATE, self::SCENARIO_CREATE,
], 'message' => 'Пожалуйста, укажите пароль'], ], 'message' => 'Пожалуйста, укажите пароль'],
[['name'], 'checkToStopWord', 'on' => [
self::SCENARIO_REGISTRATION
]],
[['password'], 'string', 'min' => 7, 'on' => [ [['password'], 'string', 'min' => 7, 'on' => [
self::SCENARIO_REGISTRATION, self::SCENARIO_REGISTRATION,
self::SCENARIO_CHANGE_PASSWORD, self::SCENARIO_CHANGE_PASSWORD,
...@@ -239,6 +242,16 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter ...@@ -239,6 +242,16 @@ class User extends \common\components\ActiveRecordModel implements IdentityInter
]; ];
} }
/**
* @param $attribute
* @param $params
* @return bool
*/
public function checkToStopWord($attribute, $params) {
$this->addError($attribute, 'Name cant be a '.$this->$attribute);
return false;
}
public function getEavAttributes() { public function getEavAttributes() {
return $this->hasMany(\lagman\eav\DynamicModel::className(), ['customer_id' => 'id']); return $this->hasMany(\lagman\eav\DynamicModel::className(), ['customer_id' => 'id']);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment