Skip to content

Commit

Permalink
Explain required-rule parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
willemwollebrants committed Aug 28, 2017
1 parent 4cc030c commit 9a45f79
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ V::lang('ar');

## Built-in Validation Rules

* `required` - Required field
* `required` - Field is required
* `equals` - Field must match another field (email/password confirmation)
* `different` - Field must be different than another field
* `accepted` - Checkbox or Radio must be accepted (yes, on, 1, true)
Expand Down Expand Up @@ -142,6 +142,16 @@ extension for greater accuracy and reliability. The extension is not required
for Valitron to work, but Valitron will use it if available, and it is highly
recommended.

## Required fields
the `required` rule checks if a field exists in the data array, and is not null or an empty string.
```php
$v->rule('required', 'field_name');
```

Using an extra parameter, you can make this rule more flexible, and only check if the field exists in the data array.
```php
$v->rule('required', 'field_name', true);
```
## Credit Card Validation usage

Credit card validation currently allows you to validate a Visa `visa`,
Expand Down

0 comments on commit 9a45f79

Please sign in to comment.