NAMESPACE: Bootstrap/Models
Models/Validators.php
Validates input variables by a set of rules. If variables are not explicitly passed it will default to the currently submitted ones.Validation depends on the rules and each of them passing. The validation rules are passed as key value pairs where the key is the name of the variable in the input and the value is the ruleset.The ruleset is a string that can define multiple validation rules. Each rule in the string is separated using ‘|’ as a delimeter. Additional parameters can be passed to the rule using ‘:’Each rule depends on the trait having defined a method with the appropriate name.Example ruleset: aray( ‘name’ => ’empty|length:3′, ‘age’ => ’empty|greater_than:18′, ’email’ => ’empty|email’ )Supported rules: empty, length, greater_than, less_than, email, website, password
$rules |
$variables |
Fill a validation error based on the provided rule and variable name. Different rules have different validation error formatting.The errors are filled in the $validation_errors property and are then used in the controller or view to signal the user.If you defined a new validation rule you should add a validation message for it here. Otherwise it will display the default one.
$rule |
$variable |
$param |
Validates whether the given value is not empty.
$value |
$value |
$length |
$value |
$number |
$value |
$number |
Email validation
Website validation
$url |
Password validation
$password |
$strict |