I have 3 types of data to check
- group data
- single data
- single and data in a combined group
This check works for single data.
$validator = Validator::make($request->all(), [ 'tests.*.finding' => 'required',
Example data above
["tests"=> [ 0 => ["finding"=>""] ], [ 1 => ["finding"=>""] ] ]
And this check works for the data in the group
$validator = Validator::make($request->all(), [ 'tests.*.*.finding' => 'required',
Example data above
["tests"=> [ "A" =>[ [ 0 => ["finding"=>""] ], [ 1 => ["finding"=>""] ] ], "B" =>[ [ 0 => ["finding"=>""] ], [ 1 => ["finding"=>""] ] ] ] ]
How to check for single and data in a combined group
Combined Data Example
["tests"=> [ "A" =>[ [ 0 => ["finding"=>""] ], [ 1 => ["finding"=>""] ] ] ], [ 0 => ["finding"=>""] ], [ 1 => ["finding"=>""] ] ]
Please help me fix this, since the first script always gives an error for the second script and vice versa.
php validation laravel laravel-5 laravel-validation
C2486
source share