How to validate an array coming from HTML form?
ex:
<input type="text" name="test" value="[value1,value2,value3]">
In Laravel:
$validate = Validator::make(
$request->all(),
['test.*'=> 'max:10']
);
But in PHP code the trick doesn't work
In laravel you could try this:
Controller -
public function someAction(){
$validator = Validator::make($request->all(),
[
'test' => 'required|max:10',
'test2' => 'required|max:2'
]
);
if($validator-fails()){
return Somthing;
}else{
// Pass the form input fields values for use
$test = Input::get('test');
$test2 = Input::get('test2');
}
}
Or try this method given here