add new custom validations
This commit is contained in:
parent
237801e9ed
commit
eea8855d07
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace CustomValidations;
|
||||
|
||||
use Respect\Validation\Rules\AbstractRule;
|
||||
|
||||
class ValidArticleContent extends AbstractRule {
|
||||
|
||||
public function validate($content) {
|
||||
$article = \Article::getDataStore($content, 'content');
|
||||
return $article->isNull();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace CustomValidations;
|
||||
|
||||
use Respect\Validation\Rules\AbstractRule;
|
||||
|
||||
class ValidArticleName extends AbstractRule {
|
||||
|
||||
public function validate($name) {
|
||||
$article = \Article::getDataStore($name, 'title');
|
||||
return $article->isNull();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace CustomValidations;
|
||||
|
||||
use Respect\Validation\Rules\AbstractRule;
|
||||
|
||||
class ValidTopicName extends AbstractRule {
|
||||
|
||||
public function validate($name) {
|
||||
$topic = \Topic::getDataStore($name, 'name');
|
||||
return $topic->isNull();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue