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

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

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

html - jQuery UI Sortable - Remove placeholder after item is dropped -