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

[8.x] Added declined and declined_if validation rules #39579

Merged
merged 1 commit into from
Nov 11, 2021
Merged

[8.x] Added declined and declined_if validation rules #39579

merged 1 commit into from
Nov 11, 2021

Conversation

Frozire
Copy link
Contributor

@Frozire Frozire commented Nov 11, 2021

Adds declined and declined_if validation rules.

Reverse off the accepted and accepted_if rules that require 'yes', 'on', '1', 1, true, 'true', these rules require a 'no', 'off', '0', 0, false, 'false' value.

As these functions are only new additions, they should not break anything.

Documentation PR: laravel/docs#7425
Laravel PR: laravel/laravel#5723

@Frozire Frozire changed the title Added declined and declined_if validation rules [8.x] Added declined and declined_if validation rules Nov 11, 2021
@taylorotwell
Copy link
Member

Can you explain the use case from your application for this?

@Frozire
Copy link
Contributor Author

Frozire commented Nov 11, 2021

Can you explain the use case from your application for this?

We are running a financial application where users answer yes, and no selectors, such as are you registered as a bad payer or do you have existing debt. We could solve our issue by reversing the question's phrasing, e.g. "not_registered_as_a_bad_payer", and using the accepted rule but this reduces intent.

At the same time, we allow financial instances to select their configurations of what they allow or disallow. This rule could help us align validation closer to the original intent and limit developer or interpretation errors when used to compare each input to each business's configuration; simply by avoiding a "semi-double negative".

@taylorotwell taylorotwell merged commit 2049de7 into laravel:8.x Nov 11, 2021
@taylorotwell
Copy link
Member

Thanks for contributing to Laravel! ❤️

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.

None yet

2 participants