Added sample for filter validator (#16494) (#16559) [skip ci]

This commit is contained in:
Evgeniy Moiseenko
2018-07-27 18:59:51 +03:00
committed by Alexander Makarov
parent ec792617ba
commit 602ba9760e
2 changed files with 14 additions and 0 deletions

View File

@ -308,6 +308,13 @@ function foo($model, $attribute) {
// нормализация значения происходит тут
return $value;
}],
// нормализует значение "phone" используя функцию "normalizePhone"
['phone', 'filter', 'filter' => [$this, 'normalizePhone']],
public function normalizePhone($value) {
return $value;
}
]
```

View File

@ -367,6 +367,13 @@ section for complete coverage about uploading files and performing validation ab
// normalize phone input here
return $value;
}],
// normalize "phone" using the function "normalizePhone"
['phone', 'filter', 'filter' => [$this, 'normalizePhone']],
public function normalizePhone($value) {
return $value;
}
]
```