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

[9.x] Add uppercase validation rule #44918

Merged
merged 1 commit into from
Nov 14, 2022
Merged

[9.x] Add uppercase validation rule #44918

merged 1 commit into from
Nov 14, 2022

Conversation

michaelnabil230
Copy link
Contributor

@michaelnabil230 michaelnabil230 commented Nov 12, 2022

This PR introduces an "uppercase" validation rule.

We have a current want for this rule to create some standardized data formatting without changing the case on the user silently.

For example, we want a user to be able to create a database user, but we want to force the user to uppercase.

Usage:

Validator::make(['name' => 'ADMIN'], ['name' => ['required', 'string', 'uppercase']);

I don't have a real use case for an "uppercase" rule, so I did not include it. If we want it for consistency, I can follow up with one (or someone else is welcome to add it).

Documentation: laravel/docs#8336

@MaRmARk0
Copy link

I recently wanted to validate whether incoming language identifier is an uppercase string, e.g. "SK", "CZ", "EN" etc. so this comes handy now.

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.

3 participants