eee
This commit is contained in:
@@ -8,10 +8,10 @@ interface ValidatorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool;
|
||||
public function dispatch(mixed $data, object $class): bool;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,22 +3,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Email implements ValidatorInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -29,17 +20,12 @@ class Email implements ValidatorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@ class Ignore implements ValidatorInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class In implements ValidatorInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
*/
|
||||
@@ -27,18 +18,13 @@ class In implements ValidatorInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,20 +3,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Length implements ValidatorInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
@@ -26,19 +18,13 @@ class Length implements ValidatorInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,20 +3,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Max implements ValidatorInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
@@ -27,18 +19,12 @@ class Max implements ValidatorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class MaxLength implements ValidatorInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
@@ -28,19 +19,13 @@ class MaxLength implements ValidatorInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Min implements ValidatorInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
*/
|
||||
@@ -27,19 +18,13 @@ class Min implements ValidatorInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,22 +3,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class MinLength implements ValidatorInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
*/
|
||||
@@ -27,19 +18,13 @@ class MinLength implements ValidatorInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
if ($data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4,43 +4,28 @@ declare(strict_types=1);
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Must implements ValidatorInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
* @param mixed $value
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
public function __construct(readonly public mixed $value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __construct(readonly public mixed $value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
return $data === $this->value;
|
||||
}
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
return $data === $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class NotEmpty implements ValidatorInterface
|
||||
@@ -13,25 +11,12 @@ class NotEmpty implements ValidatorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
return !empty($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
@@ -13,14 +11,6 @@ class NotIn implements ValidatorInterface
|
||||
{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
*/
|
||||
@@ -29,19 +19,13 @@ class NotIn implements ValidatorInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
return !in_array($data, $this->value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class NotNull implements ValidatorInterface
|
||||
@@ -13,24 +11,12 @@ class NotNull implements ValidatorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
return !($data === null);
|
||||
}
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
return !($data === null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Phone implements ValidatorInterface
|
||||
@@ -14,23 +12,12 @@ class Phone implements ValidatorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
return preg_match(self::REG, $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Kiri\Router\Validator\Inject;
|
||||
|
||||
use Kiri\Di\Inject\Container;
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Required implements ValidatorInterface
|
||||
@@ -13,23 +11,12 @@ class Required implements ValidatorInterface
|
||||
|
||||
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
#[Container(RequestInterface::class)]
|
||||
public RequestInterface $request;
|
||||
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
if ($this->request->getIsPost()) {
|
||||
$data = $this->request->post($name, null);
|
||||
} else {
|
||||
$data = $this->request->query($name, null);
|
||||
}
|
||||
return !($data === null);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,13 @@ class Round implements ValidatorInterface
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param object $class
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(object $class, string $name): bool
|
||||
{
|
||||
// TODO: Implement dispatch() method.
|
||||
return round($class->$name, $this->value) === $class->$name;
|
||||
/**
|
||||
* @param mixed $data
|
||||
* @param object $class
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatch(mixed $data, object $class): bool
|
||||
{
|
||||
return round($data, $this->value) === $data;
|
||||
}
|
||||
}
|
||||
|
||||
+28
-15
@@ -5,6 +5,7 @@ namespace Kiri\Router\Validator;
|
||||
|
||||
use Kiri\Router\Interface\ValidatorInterface;
|
||||
use Kiri\Router\Request;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
|
||||
@@ -70,36 +71,48 @@ class Validator
|
||||
$data = $request->getQueryParams();
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
if (property_exists($this->formData, $key)) {
|
||||
$type = new \ReflectionProperty($this->formData, $key);
|
||||
if (!($type->getType() instanceof \ReflectionUnionType)) {
|
||||
$value = match ($type->getType()?->getName()) {
|
||||
'int' => (int)$value,
|
||||
'float' => (float)$value,
|
||||
default => $value
|
||||
};
|
||||
}
|
||||
if ($value === 'Null') {
|
||||
$value = null;
|
||||
}
|
||||
$this->formData->{$key} = $value;
|
||||
if (!property_exists($this->formData, $key)) {
|
||||
$this->addError($key);
|
||||
return $this;
|
||||
}
|
||||
$type = new \ReflectionProperty($this->formData, $key);
|
||||
if (!($type->getType() instanceof \ReflectionUnionType)) {
|
||||
$value = match ($type->getType()?->getName()) {
|
||||
'int' => (int)$value,
|
||||
'float' => (float)$value,
|
||||
default => $value
|
||||
};
|
||||
}
|
||||
if ($value === 'Null') {
|
||||
$value = null;
|
||||
}
|
||||
$this->formData->{$key} = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @return bool
|
||||
*/
|
||||
public function run(): bool
|
||||
public function run(RequestInterface $request): bool
|
||||
{
|
||||
if (!empty($this->message)) {
|
||||
return false;
|
||||
}
|
||||
foreach ($this->rules as $name => $rule) {
|
||||
$value = $request->query($name, null);
|
||||
if ($request->getIsPost()) {
|
||||
$value = $request->post($name, null);
|
||||
}
|
||||
foreach ($rule as $item) {
|
||||
if (!$item->dispatch($this->formData, $name)) {
|
||||
/** @var ValidatorInterface $item */
|
||||
if (!$item->dispatch($value, $this->formData)) {
|
||||
return $this->addError($name);
|
||||
}
|
||||
}
|
||||
$this->formData->{$name} = $value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,8 @@ class ValidatorMiddleware implements MiddlewareInterface
|
||||
*/
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
$validator = $this->validator->bindData($request);
|
||||
if (!$validator->run()) {
|
||||
return $this->response->html($validator->error(), 415);
|
||||
if (!$this->validator->run($request)) {
|
||||
return $this->response->html($this->validator->error(), 415);
|
||||
} else {
|
||||
return $handler->handle($request);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user