当前位置: 首页>>代码示例>>PHP>>正文


PHP Validator::requirePresence方法代码示例

本文整理汇总了PHP中Cake\Validation\Validator::requirePresence方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::requirePresence方法的具体用法?PHP Validator::requirePresence怎么用?PHP Validator::requirePresence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Validation\Validator的用法示例。


在下文中一共展示了Validator::requirePresence方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'uuid'])->allowEmpty('id', 'create');
     $validator->requirePresence('title', 'create')->notEmpty('title');
     $validator->requirePresence('body', 'create')->notEmpty('body');
     return $validator;
 }
开发者ID:bobombolo,项目名称:fotomucker,代码行数:13,代码来源:CaptionsTable.php

示例2: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->requirePresence('code', 'create')->notEmpty('code')->add('code', 'unique', ['rule' => 'validateUnique', 'provider' => 'table']);
     $validator->requirePresence('name', 'create')->notEmpty('name');
     return $validator;
 }
开发者ID:kenkitchen,项目名称:cakehrms-tutorial,代码行数:13,代码来源:DepartmentsTable.php

示例3: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->requirePresence('username')->add('username', 'validFormat', ['rule' => 'email', 'message' => 'E-mail must be valid']);
     $validator->requirePresence('password', 'create')->notEmpty('password');
     return $validator;
 }
开发者ID:sunilsinh,项目名称:developers,代码行数:13,代码来源:UsersTable.php

示例4: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->integer('id')->allowEmpty('id', 'create');
     $validator->requirePresence('name', 'create')->notEmpty('name')->add('name', 'unique', ['rule' => 'validateUnique', 'provider' => 'table'])->add('name', 'validFormat', ['rule' => array('custom', '/^[A-Za-záéíóúÁÉÍÓÚñÑ0-9" "\\,\\.\\-\\:\\[\\]\\(\\)\\"]+$/'), 'message' => 'Formato inválido']);
     $validator->requirePresence('image_name', 'create')->notEmpty('image_name');
     return $validator;
 }
开发者ID:raguilar0,项目名称:TCU_FEUCR,代码行数:13,代码来源:HeadquartersTable.php

示例5: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  *
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->integer('id')->allowEmpty('id', 'create');
     $validator->requirePresence('name', 'create')->notEmpty('name');
     $validator->requirePresence('website', 'create')->notEmpty('website');
     return $validator;
 }
开发者ID:fxleblanc,项目名称:Website,代码行数:14,代码来源:UniversitiesTable.php

示例6: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->requirePresence('username', 'create')->notEmpty('username');
     $validator->requirePresence('password', 'create')->notEmpty('password');
     $validator->requirePresence('first_name', 'create')->notEmpty('first_name');
     $validator->requirePresence('last_name', 'create')->notEmpty('last_name');
     $validator->allowEmpty('first_name_uk');
     $validator->allowEmpty('last_name_uk');
     $validator->allowEmpty('first_name_ru');
     $validator->allowEmpty('last_name_ru');
     $validator->allowEmpty('phone');
     $validator->add('email', 'valid', ['rule' => 'email'])->requirePresence('email', 'create')->notEmpty('email');
     $validator->allowEmpty('gmail');
     $validator->allowEmpty('skype');
     $validator->allowEmpty('social_fb');
     $validator->add('official', 'valid', ['rule' => 'boolean'])->allowEmpty('official');
     $validator->add('work_start_date', 'valid', ['rule' => 'datetime'])->allowEmpty('work_start_date');
     $validator->add('work_finish_date', 'valid', ['rule' => 'datetime'])->allowEmpty('work_finish_date');
     $validator->add('birthday', 'valid', ['rule' => 'datetime'])->allowEmpty('birthday');
     $validator->allowEmpty('ssh_key');
     $validator->allowEmpty('hash');
     $validator->add('table_num', 'valid', ['rule' => 'numeric'])->allowEmpty('table_num');
     return $validator;
 }
开发者ID:xainse,项目名称:oxhr,代码行数:31,代码来源:UsersTable.php

示例7: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('Registration_ID', 'valid', ['rule' => 'numeric'])->allowEmpty('Registration_ID', 'create');
     $validator->add('Student_ID', 'valid', ['rule' => 'numeric'])->requirePresence('Student_ID', 'create')->notEmpty('Student_ID');
     $validator->add('Exam_ID', 'valid', ['rule' => 'numeric'])->requirePresence('Exam_ID', 'create')->notEmpty('Exam_ID');
     $validator->allowEmpty('Outcome');
     $validator->add('Date_Materials_Sent', 'valid', ['rule' => 'date'])->allowEmpty('Date_Materials_Sent');
     $validator->allowEmpty('Retest');
     $validator->allowEmpty('Payer_Name');
     $validator->allowEmpty('Payment_Type');
     $validator->allowEmpty('Check_Number');
     $validator->add('Check_Date', 'valid', ['rule' => 'date'])->allowEmpty('Check_Date');
     $validator->allowEmpty('Check_Name');
     $validator->allowEmpty('Verisign_Transaction_Number');
     $validator->allowEmpty('Verisign_Address_Line1');
     $validator->allowEmpty('Verisign_Address_Line2');
     $validator->add('Payment_Code_ID', 'valid', ['rule' => 'numeric'])->allowEmpty('Payment_Code_ID');
     $validator->requirePresence('Payment_Execution_Date_Time', 'create')->notEmpty('Payment_Execution_Date_Time');
     $validator->add('Amount_Charged', 'valid', ['rule' => 'decimal'])->allowEmpty('Amount_Charged');
     $validator->add('Amount_Paid', 'valid', ['rule' => 'decimal'])->allowEmpty('Amount_Paid');
     $validator->allowEmpty('Disability_Accomodations');
     $validator->allowEmpty('Alternate_Test_Site_Requirement');
     $validator->allowEmpty('Location');
     $validator->allowEmpty('Registration_Complete_Flag');
     $validator->allowEmpty('Mail_Confirmation');
     $validator->allowEmpty('Status');
     $validator->add('Date_Passed', 'valid', ['rule' => 'date'])->allowEmpty('Date_Passed');
     $validator->add('Raw_Passing_Score', 'valid', ['rule' => 'numeric'])->allowEmpty('Raw_Passing_Score');
     $validator->allowEmpty('Required_Non_Saturday_Admission');
     $validator->allowEmpty('Release_Contact_Info_To_Others');
     $validator->allowEmpty('Note');
     $validator->requirePresence('Last_Update', 'create')->notEmpty('Last_Update');
     return $validator;
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:40,代码来源:RegistrationTTable.php

示例8: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->allowEmpty('firstname');
     $validator->allowEmpty('lastname');
     $validator->allowEmpty('instagram');
     $validator->allowEmpty('twitter');
     $validator->allowEmpty('activity_searched');
     $validator->add('insta_followers', 'valid', ['rule' => 'numeric'])->allowEmpty('insta_followers');
     $validator->add('twitter_followers', 'valid', ['rule' => 'numeric'])->allowEmpty('twitter_followers');
     $validator->add('facebook_followers', 'valid', ['rule' => 'numeric'])->allowEmpty('facebook_followers');
     $validator->add('noddi_rank', 'valid', ['rule' => 'numeric'])->allowEmpty('noddi_rank');
     $validator->add('offers_attempted', 'valid', ['rule' => 'numeric'])->requirePresence('offers_attempted', 'create')->notEmpty('offers_attempted');
     $validator->add('offers_accepted', 'valid', ['rule' => 'numeric'])->requirePresence('offers_accepted', 'create')->notEmpty('offers_accepted');
     $validator->allowEmpty('hobbies');
     $validator->allowEmpty('city');
     $validator->add('age', 'valid', ['rule' => 'numeric'])->allowEmpty('age');
     $validator->requirePresence('personnality', 'create')->notEmpty('personnality');
     $validator->requirePresence('lifestyle', 'create')->notEmpty('lifestyle');
     $validator->add('has_blog', 'valid', ['rule' => 'numeric'])->requirePresence('has_blog', 'create')->notEmpty('has_blog');
     $validator->add('brandExperience', 'valid', ['rule' => 'numeric'])->requirePresence('brandExperience', 'create')->notEmpty('brandExperience');
     $validator->requirePresence('socialPresence', 'create')->notEmpty('socialPresence');
     $validator->requirePresence('fb_token', 'create')->notEmpty('fb_token');
     $validator->add('boost', 'valid', ['rule' => 'numeric'])->allowEmpty('boost');
     return $validator;
 }
开发者ID:CalypsoTeam,项目名称:Noddi,代码行数:32,代码来源:ModeusesTable.php

示例9: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     /*autorise de 4 à 14 caractères de type :  
      *(a-z) alphanumérique minuscule, 
      * (A-Z) alphanumérique majuscule,
      *(0-9) 0 à 9, (_-) l’underscore et le tiret.
      */
     $regexUsername = '/^[a-zA-Z0-9_-]{4,14}$/';
     /*autorise de 8 à 12 caractères de type :
      *(a-z) alphanumérique minuscule,
      *(A-Z) alphanumérique majuscule,
      *(0-9) chiffres de 0 à 9,
      *(?@.;:!_-) les caractères ? @ . ; : ! _ et - 
      */
     $regexPassword = ' /^[a-zA-Z0-9?@\\.;:!_-]{8,12}$/';
     $validator->integer('id')->allowEmpty('id', 'create');
     $validator->requirePresence('username', 'create')->notEmpty('username')->add('username', 'validFormat', ['rule' => ['custom', $regexUsername], 'message' => 'Le nom d\'utilisateur autorise de 8 à 12 caractères de type :
                             (a-z) alphanumérique minuscule,
                             (A-Z) alphanumérique majuscule,
                             (0-9) chiffres de 0 à 9,
                             (?@.;:!_-) les caractères ? @ . ; : ! _ et - ']);
     $validator->requirePresence('password', 'create')->notEmpty('password')->add('password', 'validFormat', ['rule' => ['custom', $regexPassword], 'message' => 'Le mot de passe autorise de 8 à 12 caractères de type :
                 (a-z) alphanumérique minuscule,
                 (A-Z) alphanumérique majuscule,
                 (0-9) chiffres de 0 à 9,
                 (?@.;:!_-) les caractères ? @ . ; : ! _ et -  ']);
     $validator->requirePresence('first_name', 'create')->notEmpty('first_name');
     $validator->requirePresence('last_name', 'create')->notEmpty('last_name');
     $validator->email('email')->requirePresence('email', 'create')->notEmpty('email');
     return $validator;
 }
开发者ID:AFPA-Dijon,项目名称:afpa,代码行数:37,代码来源:UsersTable.php

示例10: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator
  *        	Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('Individual_ID', 'valid', ['rule' => 'numeric'])->allowEmpty('Individual_ID', 'create');
     $validator->allowEmpty('First_Name');
     $validator->allowEmpty('Middle_Initial');
     $validator->requirePresence('Last_Name', 'create')->notEmpty('Last_Name');
     $validator->allowEmpty('Address1');
     $validator->allowEmpty('Address2');
     $validator->allowEmpty('City');
     $validator->allowEmpty('State');
     $validator->allowEmpty('Postal_Code');
     $validator->allowEmpty('Country');
     $validator->allowEmpty('Home_Phone');
     $validator->allowEmpty('Mobile_Phone');
     $validator->allowEmpty('Email_Address');
     $validator->allowEmpty('Alternate_Email_Address');
     $validator->allowEmpty('Password');
     $validator->allowEmpty('Preferred_Address');
     $validator->allowEmpty('Do_Not_Mail');
     $validator->allowEmpty('Is_Student');
     $validator->allowEmpty('Is_Volunteer');
     $validator->allowEmpty('Is_Contact');
     $validator->allowEmpty('Note');
     $validator->requirePresence('Last_Update', 'create')->notEmpty('Last_Update');
     return $validator;
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:33,代码来源:IndividualTTable.php

示例11: validationDefault

 public function validationDefault(Validator $validator)
 {
     $validator->requirePresence('nome', 'create')->notEmpty('nome', 'Por favor informe esse campo')->add("nome", array("length" => array('rule' => ['minLength', 6], 'message' => 'O nome deve ter pelo menos 6 caracteres.')));
     $validator->requirePresence('username', 'create')->notEmpty('username', 'Por favor informe esse campo')->add("username", array("length" => array('rule' => ['minLength', 6], 'message' => 'O username deve ter pelo menos 6 caracteres.')));
     $validator->requirePresence('password', 'create')->notEmpty('password', 'Por favor informe esse campo')->add("password", array("length" => array('rule' => ['minLength', 6], 'message' => 'A password deve ter pelo menos 6 caracteres.')));
     return $validator;
 }
开发者ID:edolfuchs,项目名称:sys,代码行数:7,代码来源:UsuarioTable.php

示例12: _buildValidator

 protected function _buildValidator(Validator $validator)
 {
     $validator->requirePresence('newpw')->notEmpty('newpw');
     $validator->requirePresence('confirm')->notEmpty('confirm');
     $validator->requirePresence('postcode')->notEmpty('postcode');
     return $validator;
 }
开发者ID:CubScoutCake,项目名称:CubEventBooking,代码行数:7,代码来源:PasswordForm.php

示例13: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->requirePresence('title', 'create')->notEmpty('title');
     $validator->allowEmpty('slug');
     $validator->allowEmpty('thumbnail');
     $validator->requirePresence('url', 'create')->notEmpty('url');
     $validator->add('rank', 'valid', ['rule' => 'numeric'])->allowEmpty('rank');
     $validator->allowEmpty('options');
     $validator->allowEmpty('plan');
     $validator->add('status', 'valid', ['rule' => 'numeric'])->allowEmpty('status');
     $validator->add('min_spend', 'valid', ['rule' => 'numeric'])->allowEmpty('min_spend');
     $validator->add('max_spend', 'valid', ['rule' => 'numeric'])->allowEmpty('max_spend');
     $validator->allowEmpty('referral');
     $validator->add('withdrawal_type', 'valid', ['rule' => 'numeric'])->allowEmpty('withdrawal_type');
     $validator->add('rating', 'valid', ['rule' => 'numeric'])->allowEmpty('rating');
     $validator->requirePresence('contact_email', 'create')->notEmpty('contact_email');
     $validator->allowEmpty('description');
     $validator->allowEmpty('pay_systems');
     $validator->allowEmpty('support_tg');
     $validator->allowEmpty('support_dtm');
     $validator->allowEmpty('support_mmg');
     $validator->allowEmpty('support_mmgp');
     $validator->allowEmpty('review_url');
     $validator->add('date_started', 'valid', ['rule' => 'datetime'])->allowEmpty('date_started');
     $validator->add('date_added', 'valid', ['rule' => 'datetime'])->allowEmpty('date_added');
     $validator->add('date_closed', 'valid', ['rule' => 'datetime'])->allowEmpty('date_closed');
     $validator->add('confirmed', 'valid', ['rule' => 'numeric'])->allowEmpty('confirmed');
     return $validator;
 }
开发者ID:vanhoanweb,项目名称:lister,代码行数:36,代码来源:ListingsTable.php

示例14: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->add('tipo_documento', 'valid', ['rule' => 'numeric'])->requirePresence('tipo_documento', 'create')->notEmpty('tipo_documento');
     $validator->allowEmpty('numero_documento');
     $validator->requirePresence('primer_nombre', 'create')->notEmpty('primer_nombre');
     $validator->allowEmpty('segundo_nombre');
     $validator->requirePresence('primer_apellido', 'create')->notEmpty('primer_apellido');
     $validator->allowEmpty('segundo_apellido');
     $validator->allowEmpty('genero');
     $validator->requirePresence('usuario', 'create')->notEmpty('usuario');
     $validator->requirePresence('pass', 'create')->notEmpty('pass');
     $validator->add('email', 'valid', ['rule' => 'email'])->requirePresence('email', 'create')->notEmpty('email');
     $validator->requirePresence('telefono', 'create')->notEmpty('telefono');
     $validator->add('id_ciudad', 'valid', ['rule' => 'numeric'])->requirePresence('id_ciudad', 'create')->notEmpty('id_ciudad');
     $validator->allowEmpty('direccion');
     $validator->add('fecha_nacimiento', 'valid', ['rule' => 'date'])->requirePresence('fecha_nacimiento', 'create')->notEmpty('fecha_nacimiento');
     $validator->allowEmpty('foto');
     $validator->add('estado', 'valid', ['rule' => 'numeric'])->allowEmpty('estado');
     $validator->add('fecha_inicio', 'valid', ['rule' => 'datetime'])->requirePresence('fecha_inicio', 'create')->notEmpty('fecha_inicio');
     $validator->add('codigo', 'valid', ['rule' => 'numeric'])->allowEmpty('codigo');
     $validator->add('create_at', 'valid', ['rule' => 'datetime'])->requirePresence('create_at', 'create')->notEmpty('create_at');
     $validator->add('update_at', 'valid', ['rule' => 'datetime'])->requirePresence('update_at', 'create')->notEmpty('update_at');
     return $validator;
 }
开发者ID:Nelpin,项目名称:nigbox,代码行数:31,代码来源:UsuariosTable.php

示例15: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  *
  * @author Marcelo Rocha <marcelo@promosapiens.com.br>
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('id', 'valid', ['rule' => 'numeric'])->allowEmpty('id', 'create');
     $validator->requirePresence('name')->notEmpty('name', 'We need the anime name.');
     $validator->requirePresence('episodes')->notEmpty('episodes', 'We need the episodes number.')->add('episodes', ['naturalNumber' => ['rule' => ['naturalNumber'], 'message' => 'We need a valid episodes number']]);
     return $validator;
 }
开发者ID:rochamarcelo,项目名称:slim3-cakephp3-orm,代码行数:15,代码来源:AnimesTable.php


注:本文中的Cake\Validation\Validator::requirePresence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。