Skip to content

Commit 6cfed66

Browse files
Adds Validator::setValue and make Validator::getValue public (#6292)
Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com> Co-authored-by: Lu Fei <52o@qq52o.cn>
1 parent 00c5173 commit 6cfed66

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/Validator.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,25 @@ public function setContainer(ContainerInterface $container)
698698
$this->container = $container;
699699
}
700700

701+
/**
702+
* Get the value of a given attribute.
703+
*/
704+
public function getValue(string $attribute)
705+
{
706+
return Arr::get($this->data, $attribute);
707+
}
708+
709+
/**
710+
* Set the value of a given attribute.
711+
*
712+
* @param string $attribute
713+
* @param mixed $value
714+
*/
715+
public function setValue($attribute, $value)
716+
{
717+
Arr::set($this->data, $attribute, $value);
718+
}
719+
701720
/**
702721
* Validate a given attribute against a rule.
703722
*
@@ -967,14 +986,6 @@ protected function getRule(string $attribute, mixed $rules): ?array
967986
return null;
968987
}
969988

970-
/**
971-
* Get the value of a given attribute.
972-
*/
973-
protected function getValue(string $attribute)
974-
{
975-
return Arr::get($this->data, $attribute);
976-
}
977-
978989
/**
979990
* Call a custom validator extension.
980991
*/

0 commit comments

Comments
 (0)