validation - Validating fields as unique in cakephp 3.0 -


how validate field unique in cakephp 3.0? there doesn't appear validation function listed in api.

you want use rule validateunique. example, check email address unique on userstable:-

public function validationdefault(validator $validator) {     $validator->add(         'email',          ['unique' => [             'rule' => 'validateunique',              'provider' => 'table',              'message' => 'not unique']         ]     );      return $validator; } 

details can found in the api docs.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -