Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Общая модель приложения
- */
- namespace app\models;
- use yii\base\Model;
- /**
- * Description of AppModel
- *
- * @author AZA
- */
- class AppModel extends Model{
- public function rules() {
- return[
- [['email', 'pass','dblpass','name'], 'required','message'=>'Заполните поле'],
- ['email','email'],
- ['pass','string','min'=>2,'tooShort'=>'Длинна пароля не менее 6 символов'],
- ['name','filtername']
- ];
- }
- public function attributeLabels() {
- return[
- 'pass'=>'Пароль',
- 'dblpass'=>'Повтор Пароля',
- 'name'=>'ФИО'
- ];
- }
- public function filtername($name){
- if(preg_match ('/[^\w\s]/u', $this->$name)){
- $this->addError($name,'Знаков препиная не должно быть');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement