Skip to content

Commit

Permalink
update file
Browse files Browse the repository at this point in the history
  • Loading branch information
juancristobalgd1 authored Jun 9, 2024
1 parent c857d24 commit 25fec2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
9 changes: 3 additions & 6 deletions src/libraries/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,12 @@ private function is_csrf_valid(): bool
/**
* Validate data against a set of rules.
*/
public function validate(array $rules, array $data): ?string
public function validate(array $rules, array $data): Validator
{
$validator = Validator::make($rules, $data);
$validator->validate();

if ($validator->fails()) {
return $validator->getFirstError();
}

return null;
return $validator;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/libraries/Validation/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public function validate(): bool
*/
public function fails(): bool
{
return (false === $this->startValidation());
return (false === !empty($this->errors));
}

/**
Expand Down Expand Up @@ -364,7 +364,6 @@ private function parseRuleWithEqualSign(string $ruleItem, string $field): array
};
}


/**
* Compile a "same" validation rule.
*/
Expand Down

0 comments on commit 25fec2c

Please sign in to comment.