Skip to content

[12.x] Add error message for doesnt_contain rule #56644

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

Merged
merged 2 commits into from
Aug 13, 2025

Conversation

apih
Copy link
Contributor

@apih apih commented Aug 13, 2025

This PR adds the missing error message for doesnt_contain rule. Currently, the error message produced when a validation is done with this rule is 'validation.doesnt_contain'.

@apih apih changed the title Add error message for doesnt_contain rule [12.x] Add error message for doesnt_contain rule Aug 13, 2025
@taylorotwell taylorotwell merged commit 9258a94 into laravel:12.x Aug 13, 2025
60 checks passed
Comment on lines +935 to +952

/**
* Replace all place-holders for the doesnt_contain rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array<int,string> $parameters
* @return string
*/
protected function replaceDoesntContain($message, $attribute, $rule, $parameters)
{
foreach ($parameters as &$parameter) {
$parameter = $this->getDisplayableValue($attribute, $parameter);
}

return str_replace(':values', implode(', ', $parameters), $message);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting how this is done: Incredibly redundant 😂

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