示例#1
0
 public function rules()
 {
     $parentRules = parent::rules();
     $childRules = [['nickname', 'string', 'max' => '255'], ['gender', 'integer'], ['identity_num', 'string', 'length' => [15, 18]], ['qq', 'match', 'pattern' => "/^[1-9]*[1-9][0-9]*\$/i"], ['qq', 'string', 'max' => '11'], ['birthday', 'filter', 'filter' => 'strtotime', 'skipOnEmpty' => true]];
     $rules = ArrayHelper::merge($parentRules, $childRules);
     return $rules;
 }
示例#2
0
 public function rules()
 {
     $rules = parent::rules();
     $rules['firstnameLength'] = ['firstname', 'string', 'max' => 100];
     $rules['lastnameLength'] = ['lastname', 'string', 'max' => 100];
     $rules['phoneLength'] = ['phone', 'string', 'max' => 10];
     $rules['idcardLength'] = ['idcard', 'string', 'length' => 13];
     $rules['title_idIngeger'] = ['title_id', 'integer'];
     return $rules;
 }
示例#3
0
 public function rules()
 {
     $rules = parent::rules();
     // add firstname rules
     $rules['firstnameRequired'] = ['firstname', 'required'];
     $rules['firstnameLength'] = ['firstname', 'string', 'max' => 255];
     // add lastname rules
     $rules['lastnameRequired'] = ['lastname', 'required'];
     $rules['lastnameLength'] = ['lastname', 'string', 'max' => 255];
     // add birthday rules
     $rules['birthdayRequired'] = ['birthday', 'required'];
     $rules['birthdayLength'] = ['birthday', 'date', 'format' => 'yyyy-mm-dd'];
     // add terms checkbox
     $rules['termsRequired'] = ['terms', 'required', 'requiredValue' => true, 'message' => 'You must agree to the terms and conditions'];
     $rules['termsLength'] = ['terms', 'integer'];
     return $rules;
 }
示例#4
0
文件: Profile.php 项目: kd-brinex/kd
 public function rules()
 {
     $ret = parent::rules();
     $ret = [[['name', 'public_email', 'location'], 'required', 'message' => 'Необходимо заполнить поле «{attribute}».', 'except' => ['order']], [['public_email'], 'email'], [['name', 'location'], 'match', 'pattern' => '/^[а-яА-ЯёЁ\\s-]+$/u', 'message' => 'Поле «{attribute}» может содержать только русские буквы.'], [['name'], 'string', 'max' => 15, 'tooLong' => 'Поле «{attribute}» не может превышать 15-ти символов']];
     return $ret;
 }
示例#5
0
文件: Profile.php 项目: babagay/razzd
 /**
  * @inheritdoc
  */
 public function rules()
 {
     $rules = parent::rules();
     $rules[] = [['avatar'], 'file', 'extensions' => 'jpg, png', 'mimeTypes' => 'image/jpeg, image/png', 'maxFiles' => 1];
     return $rules;
 }
示例#6
0
 public function rules()
 {
     $ret = parent::rules();
     //        $ret[]=[['telephone'], 'string', 'max' => 15];
     return $ret;
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_replace_recursive(parent::rules(), ['ImageUrlLength' => ['image_url', 'string', 'max' => 255]]);
 }