本文整理匯總了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 !');
}