Skip to content

Commit

Permalink
withValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 15, 2016
2 parents 093cf02 + 87f9761 commit bf8a36a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Illuminate/Foundation/Http/FormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,19 @@ protected function getValidatorInstance()
$factory = $this->container->make(ValidationFactory::class);

if (method_exists($this, 'validator')) {
return $this->container->call([$this, 'validator'], compact('factory'));
$validator = $this->container->call([$this, 'validator'], compact('factory'));
} else {
$validator = $factory->make(
$this->validationData(), $this->container->call([$this, 'rules']),
$this->messages(), $this->attributes()
);
}

return $factory->make(
$this->validationData(), $this->container->call([$this, 'rules']),
$this->messages(), $this->attributes()
);
if (method_exists($this, 'withValidator')) {
$this->withValidator($validator);
}

return $validator;
}

/**
Expand Down

0 comments on commit bf8a36a

Please sign in to comment.