Skip to content

Commit

Permalink
updated validation
Browse files Browse the repository at this point in the history
  • Loading branch information
schmunk42 committed Dec 9, 2016
1 parent d71e1db commit 0846964
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions models/Tree.php
Expand Up @@ -164,6 +164,13 @@ public function rules()
return ArrayHelper::merge(
parent::rules(),
[
[
'domain_id',
'default',
'value' => function ($model) {
return substr(Inflector::slug($model->name), 0, 32);
}
],
[
['domain_id', 'access_domain'],
'unique',
Expand All @@ -174,14 +181,8 @@ public function rules()
'domain_id',
'match',
'pattern' => '/^[a-z0-9_-]+$/',
'message' => \Yii::t('pages', '{0} should not contain any uppercase and special chars!', ['{attribute}'])
],
[
[
'name',
'domain_id',
],
'required',
'message' => \Yii::t('pages', '{0} should not contain any uppercase and special chars!',
['{attribute}'])
],
[
[
Expand Down

0 comments on commit 0846964

Please sign in to comment.