What is Validation Model in CakePHP?
CakePHP provide a very simple but powerful validation model so that we can easily manage our data validation. To do validation in CakePHP we can just need to declare a $validate
array in your model class for required fields.
BY Best Interview Question ON 13 Jan 2019
Example
public $validate = array(
'email' => array(
'rule' => 'email',
'message' => 'Can you please enter a valid email address.',
'required' => true
),
'phone' => array(
'rule' => array('minLength', '10'),
'message' => 'Can you please enter a valid mobile number.',
'allowEmpty' => true
)
);