Modify request input value before validation

Posted 3 years ago by marymvlg28

Hi,

I have a form with a phone input.

This input has an input mask like this 9999-999 9999

I'm using form request validation (App\Http\Requests\UserRequest.php)

I would like to validate the phone number should have 11 digits (digits:11)

I have tried $this->replace(['phone_number' => str_replace(...)]) and $this->merge(['phone_number' => str_replace(...)])

  • I know $this->replace will replace all request inputs

But none of those seems to work. Validation rule still take the original input.

can anybody help me?

Please sign in or create an account to participate in this conversation.