Skip to content

[5.8] Add ends_with validation rule#28455

Merged
taylorotwell merged 1 commit into
laravel:5.8from
jasonmccreary:ends-with-validation-rule
May 9, 2019
Merged

[5.8] Add ends_with validation rule#28455
taylorotwell merged 1 commit into
laravel:5.8from
jasonmccreary:ends-with-validation-rule

Conversation

@jasonmccreary

@jasonmccreary jasonmccreary commented May 8, 2019

Copy link
Copy Markdown
Contributor

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

jasonmccreary commented May 8, 2019

Copy link
Copy Markdown
Contributor Author

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

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

@jasonmccreary

Copy link
Copy Markdown
Contributor Author

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

@amaelftah

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