This might help: http://stackoverflow.com/questions/31850622/modify-input-before-validation-on-laravel-5-1
You need to override the getValidatorInstance function and do the changes there, here is an example
public function rules()
{
return [
'email' => 'required|email',
'phone_number' => 'numeric',
];
}
public function getValidatorInstance()
{
$this->formatPhoneNumber();
parent::getValidatorInstance();
}
protected function formatPhoneNumber()
{
$this->request->merge([
'phone_number' => str_replace('-', '', $this->request->get('phone_number'));
]);
}
Something like this should do!