當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Validator::notEmpty方法代碼示例

本文整理匯總了PHP中Cake\Validation\Validator::notEmpty方法的典型用法代碼示例。如果您正苦於以下問題:PHP Validator::notEmpty方法的具體用法?PHP Validator::notEmpty怎麽用?PHP Validator::notEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Validation\Validator的用法示例。


在下文中一共展示了Validator::notEmpty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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->notEmpty('username', 'A username is required');
     $validator->notEmpty('password', 'A password is required');
     return $validator;
 }
開發者ID:KimiyukiYamauchi,項目名稱:phppro.2015,代碼行數:13,代碼來源:UsersTable.php

示例2: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->notEmpty('title')->requirePresence('title');
     $validator->notEmpty('description');
     $validator->notEmpty('content')->requirePresence('content');
     return $validator;
 }
開發者ID:hack3rlov3,項目名稱:cakephptutorial,代碼行數:13,代碼來源:ArticlesTable.php

示例3: _buildValidation

 public function _buildValidation(Validator $validator)
 {
     $validator->add('mensagem', ['minLength' => ['rule' => ['minLength', 10], 'message' => 'A mensagem precisa ter pelo menos 10 letras']]);
     $validator->notEmpty('nome');
     $validator->notEmpty('email');
     return $validator;
 }
開發者ID:rafaelschn,項目名稱:cake3lab,代碼行數:7,代碼來源:ContatoForm.php

示例4: 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->notEmpty('title');
     $validator->notEmpty('body');
     return $validator;
 }
開發者ID:jeffblack360,項目名稱:cakeblog,代碼行數:13,代碼來源:ArticlesTable.php

示例5: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->notEmpty('username', 'Username is required');
     $validator->notEmpty('password', 'Password is required');
     $validator->notEmpty('role', 'Role is required')->add('role', 'inList', ['rule' => ['inList', ['admin', 'author']], 'message' => ' Please enter a valid role']);
     return $validator;
 }
開發者ID:hack3rlov3,項目名稱:cakephptutorial,代碼行數:13,代碼來源:UsersTable.php

示例6: _buildValidator

 protected function _buildValidator(Validator $validator)
 {
     $validator->notEmpty('nome');
     $validator->notEmpty('email');
     $validator->notEmpty('msg');
     $validator->add('msg', ["minLength" => ["rule" => ['minLength', 10], "message" => "A mensagem deve ter pelo menos 10 letras"]]);
     return $validator;
 }
開發者ID:rsaggio,項目名稱:curso-cakephp,代碼行數:8,代碼來源:ContactForm.php

示例7: 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('email', 'valid', ['rule' => 'email'])->requirePresence('email', 'create')->notEmpty('email');
     $validator->notEmpty('username');
     $validator->requirePresence('password', 'create')->notEmpty('password');
     $validator->notEmpty('role', 'A role is required')->add('role', 'inList', ['rule' => ['inList', ['admin', 'user']], 'message' => 'Please enter a valid role']);
     return $validator;
 }
開發者ID:webroup17,項目名稱:social_networking,代碼行數:15,代碼來源:UsersTable.php

示例8: validationDefault

 /**
  * Default user validation.
  *
  * @param Validator $validator
  * @return Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->notEmpty('role_id', __d('community', 'Please, chose user role.'))->notEmpty('name', __d('community', 'Please, enter you name.'));
     $validator->notEmpty('username', __d('community', 'Username could not be empty.'))->add('username', 'unique', ['provider' => 'table', 'rule' => 'validateUnique', 'message' => __d('community', 'User with this login already exists.')]);
     $validator->notEmpty('email', __d('community', 'Email could not be empty.'))->add('email', 'unique', ['provider' => 'table', 'rule' => 'validateUnique', 'message' => __d('community', 'User with this email already exists.')])->add('email', 'valid', ['rule' => 'email', 'message' => __d('community', 'Please enter valid email.')]);
     $validator->notEmpty('password', __d('community', 'Please, enter you password.'))->add('password', 'minLength', ['rule' => ['minLength', $this->_passMinLength], 'message' => __d('community', 'The minimum password length is {0}', $this->_passMinLength)]);
     $validator->notEmpty('password_confirm', __d('community', 'Please, confirm you password.'))->add('password_confirm', 'no-misspelling', ['rule' => ['compareWith', 'password'], 'message' => __d('community', 'Passwords are not equal')]);
     return $validator;
 }
開發者ID:Cheren,項目名稱:union,代碼行數:15,代碼來源:UsersTable.php

示例9: validationDefault

 public function validationDefault(Validator $validator)
 {
     $validator->notEmpty('attribute_id');
     $validator->notEmpty('item_id');
     $validator->add('attribute_id', 'valid', ['rule' => 'numeric']);
     $validator->add('item_id', 'valid', ['rule' => 'numeric']);
     $validator->requirePresence('attribute_id', 'create');
     $validator->requirePresence('item_id', 'create');
     return $validator;
 }
開發者ID:pwerken,項目名稱:va-void,代碼行數:10,代碼來源:AttributesItemsTable.php

示例10: validationDefault

 public function validationDefault(Validator $validator)
 {
     $validator->allowEmpty('id', 'create');
     $validator->notEmpty('player_id');
     $validator->notEmpty('chin');
     $validator->notEmpty('name');
     $validator->notEmpty('xp');
     $validator->notEmpty('faction_id');
     $validator->notEmpty('belief_id');
     $validator->notEmpty('group_id');
     $validator->notEmpty('world_id');
     $validator->allowEmpty('soulpath');
     $validator->notEmpty('status');
     $validator->allowEmpty('comments');
     $validator->add('id', 'valid', ['rule' => 'numeric']);
     $validator->add('player_id', 'valid', ['rule' => 'numeric']);
     $validator->add('chin', 'valid', ['rule' => 'naturalNumber']);
     $validator->add('xp', 'valid', ['rule' => ['custom', '/^[0-9]*([\\.][05])?$/']]);
     $validator->add('faction_id', 'valid', ['rule' => 'numeric']);
     $validator->add('belief_id', 'valid', ['rule' => 'numeric']);
     $validator->add('group_id', 'valid', ['rule' => 'numeric']);
     $validator->add('world_id', 'valid', ['rule' => 'numeric']);
     $validator->add('soulpath', 'valid', ['rule' => ['inList', Character::soulpathValues()]]);
     $validator->add('status', 'valid', ['rule' => ['inList', Character::statusValues()]]);
     $validator->requirePresence('player_id', 'create');
     $validator->requirePresence('chin', 'create');
     $validator->requirePresence('name', 'create');
     return $validator;
 }
開發者ID:pwerken,項目名稱:va-void,代碼行數:29,代碼來源:CharactersTable.php

示例11: validationDefault

 public function validationDefault(Validator $validator)
 {
     $validator->allowEmpty('id', 'create');
     $validator->notEmpty('name');
     $validator->notEmpty('player_text');
     $validator->allowEmpty('cs_text');
     $validator->add('id', 'valid', ['rule' => 'numeric']);
     $validator->requirePresence('name', 'create');
     $validator->requirePresence('player_text', 'create');
     return $validator;
 }
開發者ID:pwerken,項目名稱:va-void,代碼行數:11,代碼來源:ConditionsTable.php

示例12: 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('presentation', 'create')->notEmpty('presentation');
     $validator->add('weeklyHours', 'valid', ['rule' => 'numeric'])->requirePresence('weeklyHours', 'create')->notEmpty('weeklyHours');
     $validator->add('startDate', 'valid', ['rule' => 'date'])->requirePresence('startDate', 'create')->notEmpty('startDate');
     $validator->add('endDate', 'valid', ['rule' => 'date'])->requirePresence('endDate', 'create')->notEmpty('endDate');
     $validator->notEmpty('accepted');
     $validator->notEmpty('archived');
     return $validator;
 }
開發者ID:jenwei,項目名稱:Website,代碼行數:18,代碼來源:ApplicationsTable.php

示例13: validationDefault

 /**
  * Default validation rules.
  *
  * @param \Cake\Validation\Validator $validator Validator instance.
  * @return \Cake\Validation\Validator
  */
 public function validationDefault(Validator $validator)
 {
     $validator->add('iduser', 'valid', ['rule' => 'numeric'])->allowEmpty('iduser');
     $validator->add('idAnn', 'valid', ['rule' => 'numeric'])->allowEmpty('idAnn', 'create');
     $validator->notEmpty('titre');
     $validator->notEmpty('cat');
     $validator->notEmpty('lieu');
     $validator->add('prix', 'valid', ['rule' => 'numeric'])->notEmpty('prix');
     $validator->add('image', 'valid', ['rule' => ['mimeType', ['image/jpeg', 'image/png']], 'message' => __('Jpg ou PNG uniquement')])->notEmpty('image');
     $validator->notEmpty('description');
     return $validator;
 }
開發者ID:JoHein,項目名稱:LeBonCoup,代碼行數:18,代碼來源:AnnoncesTable.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->allowEmpty('group');
     $validator->add('admin', 'valid', ['rule' => 'boolean'])->allowEmpty('admin');
     $validator->allowEmpty('manager');
     $validator->notEmpty('username', 'Username is required');
     $validator->add('holiday', 'valid', ['rule' => 'numeric'])->allowEmpty('holiday');
     $validator->add('rem_holiday', 'valid', ['rule' => 'numeric'])->allowEmpty('rem_holiday');
     $validator->notEmpty('password', 'Password is required');
     return $validator;
 }
開發者ID:zoparga,項目名稱:szakdoga,代碼行數:18,代碼來源:UsersTable.php

示例15: 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->notEmpty('firstname', 'Please fill this field');
     $validator->notEmpty('lastname', 'Please fill this field');
     $validator->add('email', 'valid', ['rule' => 'email'])->notEmpty('email', 'Please fill this field');
     $validator->requirePresence('password', 'create')->add('password', ['length' => ['rule' => ['minLength', 8], 'message' => 'Password need to be at least 8 characters long'], 'letter' => ['rule' => ['custom', '/[a-z]+/'], 'message' => 'Password need to be at least one lowercase letter'], 'capital' => ['rule' => ['custom', '/[A-Z]+/'], 'message' => 'Password need to be at least one uppercase  letter'], 'number' => ['rule' => ['custom', '/[0-9]+/'], 'message' => 'Password need to be at least one number']])->notEmpty('password', 'Please fill password');
     $validator->add('is_active', 'valid', ['rule' => 'boolean'])->allowEmpty('is_active');
     $validator->allowEmpty('role');
     $validator->add('last_login', 'valid', ['rule' => 'datetime'])->allowEmpty('last_login');
     return $validator;
 }
開發者ID:hongtien510,項目名稱:cakephp-routing,代碼行數:18,代碼來源:UsersTable.php


注:本文中的Cake\Validation\Validator::notEmpty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。