In a controller, a table field could be skipped from model validations by editing the “validate” property of a model. For example, i have a “date” validation for “dob” (date of birth) field set in my “User” model. It works great everywhere except a particular place where i could accept null value for this field. In this particular case i could remove(unset) the validation for this field in my controller like this:
Hint: Please check the use of “allowEmpty”, “on” and “required” options in model’s “$validate” property and see if that fit your needs rather than using the custom unset() i just put above. I had to use it in a rare situation where i was not able to touch the “allowEmpty” and “required” options.
Hello Friends, I’m Arvind Kumar, founder of Inimist Technologies, Inimist Academy, The Fundabook and many more. I am a Full Stack Web Developer and Programmer by heart, and a Hindi/English blogger by chance. I build Web and Mobile Application around React, VueJS, NodeJS and PHP frameworks.
Have a project in mind? Get in touch