Regarding validations


Sir i want to know that how to validate 2 forms from one model means one form with 2 fields and second with 10 fields so how to validate them saperately.


What have you tried?
Some more information would be helpful in getting some support for your query,



This is my code in model

public function validationDefault(Validator $validator)
->allowEmpty(‘id’, ‘create’);

        ->requirePresence('user_name', 'create')

        ->requirePresence('name', 'create')

        ->requirePresence('last_name', 'create')

        ->requirePresence('company_name', 'create')

        ->requirePresence('company_email', 'create')

        ->requirePresence('job_title', 'create')

        ->requirePresence('phone_number', 'create')

        ->requirePresence('photo', 'create')

        ->requirePresence('status', 'create')

        ->requirePresence('password', 'create')

        ->requirePresence('email_verify_code', 'create')

        ->requirePresence('email_verified_status', 'create')

        ->requirePresence('email_verify_date', 'create')

        ->requirePresence('invalid_login_count', 'create')

        ->requirePresence('created_on', 'create')

        ->requirePresence('modified_on', 'create')

    return $validator;

public function validationLogin(){
		 $validator2 = new Validator();

but how i call my validationLogin () from my controller


sir actually i have 2 forms regarding this registration model so the question is how to validate them saperately

basicly you just need a way to know which validation to pass, there are few ways to do it but if i get your question right it should be something like this:

$this->TABLENAME->patchEntity($entity, $this->request->getData(), [
   'validate' => $this->request->getData('captcha_code') !== null ? 'login' : 'default'


Thank you very much for help .Now my code is working.Thanks a lot