本文整理汇总了PHP中validator::requirePresence方法的典型用法代码示例。如果您正苦于以下问题:PHP validator::requirePresence方法的具体用法?PHP validator::requirePresence怎么用?PHP validator::requirePresence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator
的用法示例。
在下文中一共展示了validator::requirePresence方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validationDefault
public function validationDefault(validator $validator)
{
return $validator->requirePresence('name_category')->notEmpty('name_category', 'The field category name not empty');
}
示例2: validationCustomer
public function validationCustomer(validator $validator)
{
return $validator->requirePresence('last_name')->notEmpty('last_name', 'last_name not can empty !')->add('last_name', ['minlength' => ['rule' => ['minlength', 3], 'message' => 'Last name must have least 3 characters ']])->requirePresence('first_name')->notEmpty('first_name', 'first_name not can empty !')->requirePresence('phone_number')->notEmpty('phone_number', 'phone_number not can empty !')->add('phone_number', ['minlength' => ['rule' => ['minlength', 9], 'message' => 'Phone number must have least 9 numbers'], 'maxlength' => ['rule' => ['maxlength', 12], 'message' => 'Phone number must smaller 12 numbers']])->requirePresence('email')->notEmpty('email', 'email not can empty !')->requirePresence('address')->notEmpty('address', 'address not can empty !');
}