Skip to content

Commit

Permalink
调整验证分组方法名
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Dec 18, 2024
1 parent 4752b4d commit 76f2d71
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/think/Validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,6 @@ public function check(array $data, array | string $rules = []): bool
{
$this->error = [];

if ($this->currentScene) {
$this->getScene($this->currentScene);
}

if (empty($rules)) {
// 读取验证规则
$rules = $this->rules();
Expand All @@ -659,6 +655,10 @@ public function check(array $data, array | string $rules = []): bool
$rules = $rules->getRules();
}

if ($this->currentScene) {
$this->getScene($this->currentScene);
}

foreach ($this->append as $key => $rule) {
if (!isset($rules[$key])) {
$rules[$key] = $rule;
Expand Down Expand Up @@ -2107,7 +2107,7 @@ protected function getScene(string $scene): void
*/
protected function getGroupRules(string $group)
{
$method = 'group' . Str::studly($group);
$method = 'rules' . Str::studly($group);
if (method_exists($this, $method)) {
$validate = call_user_func_array([$this, $method], [new self]);
return $validate->alias($this->alias)
Expand Down

0 comments on commit 76f2d71

Please sign in to comment.