Skip to content

Commit

Permalink
Allow validation placeholders in models to be arrays. Fixes #930
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Feb 12, 2018
1 parent 4ca2be4 commit d50710b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,15 @@ protected function fillPlaceholders(array $rules, array $data)
{
foreach ($rules as &$rule)
{
if (is_array($rule))
{
foreach ($rule as &$row)
{
$row = strtr($row, $replacements);
}
continue;
}

$rule = strtr($rule, $replacements);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Models/ValidModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ValidModel extends Model
protected $allowedFields = ['name', 'description'];

protected $validationRules = [
'name' => 'required|min_length[3]',
'name' => ['required', 'min_length[3]'],
'token' => 'in_list[{id}]'
];

Expand Down

0 comments on commit d50710b

Please sign in to comment.