1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-22 03:32:47 +08:00
2020-08-06 20:53:30 +08:00

28 lines
557 B
PHP

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