Skip to content

[9.x] Add uppercase validation rule - #44918

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
michaelnabil230:uppercase
Nov 14, 2022
Merged

[9.x] Add uppercase validation rule#44918
taylorotwell merged 1 commit into
laravel:9.xfrom
michaelnabil230:uppercase

Conversation

@michaelnabil230

@michaelnabil230 michaelnabil230 commented Nov 12, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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