-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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] Add prohibited_if and prohibited_unless validation rules #36516
[8.x] Add prohibited_if and prohibited_unless validation rules #36516
Conversation
I know both can be considered synonyms, but I find Might be because it is more common on web-development jargon, and I am not a native English speaker. Besides of that, nice addition, I wrote a custom Rule for a past project for that exact use-case. |
I think both words make sense, but my only concern with forbidden is the association with the |
|
In that case i think that you should have an accessor, not an actual field on the database
it avoid storing the same information twice, and having possible inconsistencies |
I would usually agree, but in this case there is a clinical requirement to be able to store both, with the date being optional as it may not be known. |
I've found myself needing these validation rules on a few occasions, where
exclude_if
andexclude_unless
don't quite go far enough.For example, in the project I'm currently working on, the following payload includes contradictory information that is not sufficient to just exclude. Instead we need an outright validation failure.
Not sure if this is a common enough use-case to go into the framework, but hopefully it helps others 🙂
If this gets merged, I will follow up with a PR to
laravel/docs
and the language file inlaravel/laravel
.