I am a beginner in Laravel 5.
How can I remove whitespaces in validator?? i have read the documentation but there is no validator for trim(remove whitespaces).
here my rules
$rules = [
'name' =>'required',
'email' => 'required|email',
'address' => 'required',
'phones' => 'required'
];
thanks for your answer.
You can use the following code to trim all string input (as you might have arrays in the input)
// trim all input
Input::merge(array_map(function ($value) {
if (is_string($value)) {
return trim($value);
} else {
return $value;
}
}, Input::all()));