add new custom validations

This commit is contained in:
Guillermo Giuliana 2021-12-13 18:06:50 -03:00
parent 237801e9ed
commit eea8855d07
3 changed files with 39 additions and 0 deletions

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}