Permalink
Browse files

Merge pull request #2449 from andreluizmorita/validation_attr1

Added parameter $customAttributes in Factory and Validator to use the Validator::make()
  • Loading branch information...
taylorotwell committed Oct 31, 2013
2 parents 9869f4b + bac13df commit 93977e49559ec82e8a82f19bbdfcf4f27cfb4ac0
Showing with 7 additions and 6 deletions.
  1. +5 −5 src/Illuminate/Validation/Factory.php
  2. +2 −1 src/Illuminate/Validation/Validator.php
@@ -76,12 +76,12 @@ public function __construct(TranslatorInterface $translator, Container $containe
* @param array $messages
* @return \Illuminate\Validation\Validator
*/
public function make(array $data, array $rules, array $messages = array())
public function make(array $data, array $rules, array $messages = array(), array $customAttributes = array())
{
// The presence verifier is responsible for checking the unique and exists data
// for the validator. It is behind an interface so that multiple versions of
// it may be written besides database. We'll inject it into the validator.
$validator = $this->resolve($data, $rules, $messages);
$validator = $this->resolve($data, $rules, $messages, $customAttributes);
if ( ! is_null($this->verifier))
{
@@ -129,15 +129,15 @@ protected function addExtensions($validator)
* @param array $messages
* @return \Illuminate\Validation\Validator
*/
protected function resolve($data, $rules, $messages)
protected function resolve($data, $rules, $messages, $customAttributes)
{
if (is_null($this->resolver))
{
return new Validator($this->translator, $data, $rules, $messages);
return new Validator($this->translator, $data, $rules, $messages, $customAttributes);
}
else
{
return call_user_func($this->resolver, $this->translator, $data, $rules, $messages);
return call_user_func($this->resolver, $this->translator, $data, $rules, $messages, $customAttributes);
}
}
@@ -119,12 +119,13 @@ class Validator implements MessageProviderInterface {
* @param array $messages
* @return void
*/
public function __construct(TranslatorInterface $translator, $data, $rules, $messages = array())
public function __construct(TranslatorInterface $translator, $data, $rules, $messages = array(), $customAttributes = array())
{
$this->translator = $translator;
$this->customMessages = $messages;
$this->data = $this->parseData($data);
$this->rules = $this->explodeRules($rules);
$this->customAttributes = $customAttributes;
}
/**

0 comments on commit 93977e4

Please sign in to comment.