Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Attribute.php
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,8 +47,10 @@ public function __construct(
$this->validation = $validation;
$this->alias = $alias;
$this->key = $key;
$rule_number = 0;
foreach ($rules as $rule) {
$this->addRule($rule);
$this->addRule($rule, $rule_number);
$rule_number++;
}
}

Expand DownExpand Up@@ -125,11 +127,11 @@ public function getOtherAttributes(): array
* @param \Rakit\Validation\Rule $rule
* @return void
*/
public function addRule(Rule $rule)
public function addRule(Rule $rule, int $rule_number)
{
$rule->setAttribute($this);
$rule->setValidation($this->validation);
$this->rules[$rule->getKey()] = $rule;
$this->rules[$rule->getKey() . (string)$rule_number] = $rule;
}

/**
Expand Down