mirror of
https://github.com/flarum/core.git
synced 2025-10-13 16:05:05 +02:00
@@ -51,17 +51,6 @@ abstract class AbstractValidator
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a model is valid.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return bool
|
||||
*/
|
||||
public function valid(array $attributes)
|
||||
{
|
||||
return $this->makeValidator($attributes)->passes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw an exception if a model is not valid.
|
||||
*
|
||||
@@ -72,7 +61,7 @@ abstract class AbstractValidator
|
||||
$validator = $this->makeValidator($attributes);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$this->throwValidationException($validator);
|
||||
throw new ValidationException($validator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,15 +81,6 @@ abstract class AbstractValidator
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Validator $validator
|
||||
* @throws ValidationException
|
||||
*/
|
||||
protected function throwValidationException(Validator $validator)
|
||||
{
|
||||
throw new ValidationException($validator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a new validator instance for this model.
|
||||
*
|
||||
|
22
src/Core/Validator/AvatarValidator.php
Normal file
22
src/Core/Validator/AvatarValidator.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Validator;
|
||||
|
||||
class AvatarValidator extends AbstractValidator
|
||||
{
|
||||
protected $rules = [
|
||||
'avatar' => [
|
||||
'required',
|
||||
'image',
|
||||
'max:1024'
|
||||
]
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user