Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.7] Improve "exists" validation with array values #25819

Merged
merged 3 commits into from
Sep 28, 2018
Merged

[5.7] Improve "exists" validation with array values #25819

merged 3 commits into from
Sep 28, 2018

Conversation

staudenmeir
Copy link
Contributor

Fixes return values in tests:
getCount() and getMultiCount() return an integer instead of a boolean.

Fixes duplicate values:
If the user supplies an array with duplicate values, the validation can fail (where it should pass):

$v = new Validator($trans, ['email' => ['foo', 'foo']], ['email' => 'exists:users']);

// Fails if there is only one "foo" entry.
$v->passes();

Fixes duplicate database values:
If the database contains duplicate values, the validation can pass (where it should fail):

$v = new Validator($trans, ['first_name' => ['John', 'Jim']], ['first_name' => 'exists:users']);

// Passes if there is no "Jim" entry but 2+ "John"s entries.
$v->passes();

@taylorotwell taylorotwell merged commit 144c613 into laravel:5.7 Sep 28, 2018
@staudenmeir staudenmeir deleted the validation-exists branch September 28, 2018 21:00
Omranic added a commit to rinvex/cortex-foundation-classic that referenced this pull request Aug 22, 2022
* Fix return values in validation tests

* Fix exists validation with duplicate values

* Fix exists validation with duplicate database values

laravel/framework#25819

laravel/framework@144c613
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants