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.8] Add ends_with validation rule #28455

Merged
merged 1 commit into from May 9, 2019

Conversation

Projects
None yet
3 participants
@jasonmccreary
Copy link
Contributor

commented May 8, 2019

A starts_with validation rule exists, however an ends_with does not. Given the symmetry between other validation rules as well as the startsWith and endsWith string helper methods, why not add it. Infinitely more expressive than the nasty regex:/(foo|bar)$/ alternative.

Rule attributes are the same as starts_with, for example:

$rules = [
    'email' => 'required|ends_with:laravel.com,jasonmccreary.me',
];
@jasonmccreary

This comment has been minimized.

Copy link
Contributor Author

commented May 8, 2019

If merged, I will open PRs to update the docs and validation.php lang file accordingly.

@GrahamCampbell GrahamCampbell changed the title Add ends_with validation rule [5.8] Add ends_with validation rule May 8, 2019

@taylorotwell taylorotwell merged commit e487bff into laravel:5.8 May 9, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

jasonmccreary added a commit to jasonmccreary/docs that referenced this pull request May 9, 2019

Document "ends_with" rule
This is in conjunction with PR [#28455](laravel/framework#28455) to the framework.
@Te7a-Houdini

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

glad it finally got merged 👍 , mine didn't pass #26652

@jasonmccreary

This comment has been minimized.

Copy link
Contributor Author

commented May 9, 2019

You have to sell it in the PR notes. 😎 You were also missing code for the message replacement.

@Te7a-Houdini

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

@jasonmccreary totally agree 👌

taylorotwell added a commit to laravel/docs that referenced this pull request May 10, 2019

Document "ends_with" rule (#5183)
This is in conjunction with PR [#28455](laravel/framework#28455) to the framework.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.