1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-05 16:31:31 +08:00
course-tencent-cloud/app/Validators/ChapterArticle.php
2019-12-13 00:10:10 +08:00

27 lines
552 B
PHP

<?php
namespace App\Validators;
use App\Exceptions\BadRequest as BadRequestException;
class ChapterArticle extends Validator
{
public function checkContent($content)
{
$value = $this->filter->sanitize($content, ['trim']);
$length = kg_strlen($value);
if ($length < 10) {
throw new BadRequestException('chapter_article.content_too_short');
}
if ($length > 65535) {
throw new BadRequestException('chapter_article.content_too_long');
}
return $value;
}
}