I am developing an app using Laravel and VueJs. I have used the below form validation rules:
public function rules()
{
$rules = [
'id.*'=>'required|integer',
'job_id.*'=>'required|integer',
'satisfied.*'=>'nullable',
'client_comments.*'=>'nullable',
'improvements.*'=>'nullable',
'rating.*'=>'integer|max:10|min:0'
];
return $rules;
}
Further, I am sending the below axios request to the Laravel controller. However, the validation is not working. Could somebody can help?
The request comes to the Laravel controller as below:
array:2 [
0 => array:7 [
"client_comments" => null
"id" => 34
"improvements" => null
"job_id" => 1
"quality_cycle_id" => 14
"rating" => "10"
"satisfied" => null
]
1 => array:7 [
"client_comments" => null
"id" => 35
"improvements" => null
"job_id" => 3
"quality_cycle_id" => 14
"rating" => "9"
"satisfied" => null
]
]
I just used so many efforts to resolve this problem, but none of these worked. In the same application, I have put so many validations for single request. But this request is coming as an arrays inside array as above.
Appreciate, if somebody help.
Thanks