public function each($attribute, $rules)
{
$data = array_get($this->data, $attribute);
if (!is_array($data)) {
if ($this->hasRule($attribute, 'Array')) {
return;
}
throw new \InvalidArgumentException('Attribute for each() must be an array.');
}
foreach ($data as $dataKey => $dataValue) {
foreach ($rules as $ruleValue) {
$this->mergeRules("{$attribute}.{$dataKey}", $ruleValue);
}
}
}