[Closed][Stale Code] Fix working of unique and exists #900
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this, unique rule was case sensitive, that means it would pass strings with same chars but different case. Example, if [email protected] exists in database, applying unique rule on [email protected] SHOULD have failed, but it does not, since mongo is case sensitive, and case sensitiveness cannot be configured. See laravel/framework#9430. Also seen in #528
I've implemented a DatabasePresenceVerifier for mongodb, which overrides the default presence verifier, ONLY IF MongodbValidationServiceProvider is used. Also added test cases to make sure 'unique' and 'exists' validation rules function in a case insensitive manner.
This is an issue that affects almost all applications that would be using this plugin, and it is pretty serious.
Ping @jenssegers.