mirror of
https://github.com/flarum/framework.git
synced 2025-05-01 09:04:04 +08:00
Better check for user property in command validators
This commit is contained in:
parent
c03d8b96b8
commit
7ba59fc9a4
@ -17,10 +17,10 @@ class CommandValidator
|
|||||||
|
|
||||||
public function validate($command)
|
public function validate($command)
|
||||||
{
|
{
|
||||||
if (! $command->user) {
|
if (empty($command->user)) {
|
||||||
throw new InvalidArgumentException('Empty argument [user] in command ['.get_class($command).']');
|
throw new InvalidArgumentException('Empty argument [user] in command ['.get_class($command).']');
|
||||||
}
|
}
|
||||||
|
|
||||||
$validator = $this->validator->make(get_object_vars($command), $this->rules);
|
$validator = $this->validator->make(get_object_vars($command), $this->rules);
|
||||||
|
|
||||||
$this->fireValidationEvent([$validator, $command]);
|
$this->fireValidationEvent([$validator, $command]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user