mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-31 01:35:15 +02:00
add new custom validations
This commit is contained in:
parent
237801e9ed
commit
eea8855d07
13
server/libs/validations/validArticleContent.php
Normal file
13
server/libs/validations/validArticleContent.php
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
13
server/libs/validations/validArticleName.php
Normal file
13
server/libs/validations/validArticleName.php
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
13
server/libs/validations/validTopicName.php
Normal file
13
server/libs/validations/validTopicName.php
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user