About uniqueness in the ThinkPHP5 validator unique authentication problem

Source: Internet
Author: User

If you are adding an interface, the validation rules generally

Query SQL is like this

Because of the definition of a separate validation class, if you want to add some variables in the manual, what do you do??? (Not enough to see other uses to validate the introduction of external variables in a standalone class)

Rules like this, normal in the editing interface validation, the submission of their own data will often prompt repetition,

No solution has been found before and no suitable solution is found on the network

Today, if the primary key ID is also passed as data to the authenticator in the form (name is the same name as the primary key)
Add this sentence.

Validation rules are not changed, and validation SQL statements change automatically when validating

It also shows that if the primary key value is passed in the validation data, the data of the ID of the incoming primary key is excluded when validating uniqueness.


It's not in the manual. This way, you can exclude a primary key. (Do not know if the manual is updated) to try a few pages of verification can be.
Specific reasons, later have to go to see the source, for the time being not in-depth study.

If there is an expert who is willing to give a nudge, would like to smell its detailed haha

About uniqueness in the ThinkPHP5 validator unique authentication problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.