Did you know that Laravel has an undocumented validation rule?
As opposed to "starts_with" there is a "doesnt_start_with". Just add the translation key to validation.php
and you are good to go.
'starts_with' => 'The :attribute must start with one of the following: :values.',
'doesnt_start_with' => 'The :attribute must not start with: :values.',
Example use
SomeInput::make('Swedish phone')
->rules([
'starts_with:+46'
])
SomeInput::make('International phone')
->rules([
'doesnt_start_with:+46'
])
Comments (0)