Validation Methods
CakePHP provides various validation methods in the Validation Class. Some of the most
popular of them are listed below.
Syntax
Add
(string
$field
,
array|string
$name
,
array|Cake\Validation\ValidationRule $rule [] )
Parameters
The name of the field from which the rule will be added.
The alias for a single rule or multiple rules array.
The rule to add
Returns
$this
Description
Adds a new rule to a field's rule set. If second argument is an array,
then rules list for the field will be replaced with second argument and
third argument will be ignored.
Syntax
allowEmpty (string
$field
, boolean|string|callable
$when
true ,
string|null
$message
null)
Parameters
The name of the field.
Indicates when the field is allowed to be empty. Valid values are
Do'stlaringiz bilan baham: |