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

jasonmccreary
Copy link
Contributor

@jasonmccreary jasonmccreary 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
Copy link
Contributor Author

jasonmccreary 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
jasonmccreary added a commit to jasonmccreary/docs that referenced this pull request May 9, 2019
This is in conjunction with PR [#28455](laravel/framework#28455) to the framework.
@amaelftah
Copy link
Contributor

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

@jasonmccreary
Copy link
Contributor Author

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

@amaelftah
Copy link
Contributor

@jasonmccreary totally agree 👌

taylorotwell pushed a commit to laravel/docs that referenced this pull request May 10, 2019
This is in conjunction with PR [#28455](laravel/framework#28455) to the framework.
m777z pushed a commit to m777z/laravel-docs that referenced this pull request Jun 8, 2019
This is in conjunction with PR [#28455](laravel/framework#28455) to the framework.
gdebrauwer pushed a commit to gdebrauwer/docs that referenced this pull request Jun 20, 2019
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants