title: Multiple array validation in laravel
body: <p>I have 3 types of data to validate</p>
  
  <ol>
  <li>data in group</li>
  <li>single data</li>
  <li>single and data in group combined</li>
  </ol>
  
  <p>This validation works for single data</p>
  
  <pre><code>$validator = Validator::make($request-&gt;all(), [
      'tests.*.finding' =&gt; 'required',//works for single test
  ]);
  </code></pre>
  
  <p>Data sample for above</p>
  
  <pre><code>["tests"=&gt;
                  [
                      0 =&gt; ["finding"=&gt;""]
                  ],
                  [
                      1 =&gt; ["finding"=&gt;""]
                  ]
              ]
  </code></pre>
  
  <p>And this validation works for data in group</p>
  
  <pre><code>$validator = Validator::make($request-&gt;all(), [
      'tests.*.*.finding' =&gt; 'required',//works for group
  ]);
  </code></pre>
  
  <p>Data sample for above</p>
  
  <pre><code>  ["tests"=&gt;
                      [
                          "A" =&gt;[
                              [
                                  0 =&gt; ["finding"=&gt;""]
                              ],
                              [
                                  1 =&gt; ["finding"=&gt;""]
                              ]
                          ],
                          "B" =&gt;[
                              [
                                  0 =&gt; ["finding"=&gt;""]
                              ],
                              [
                                  1 =&gt; ["finding"=&gt;""]
                              ]
                          ]
                      ]
                  ]
  </code></pre>
  
  <p>How to validate for single and data in group combined</p>
  
  <p>Combined Data sample </p>
  
  <pre><code> ["tests"=&gt;
                      [
                          "A" =&gt;[
                              [
                                  0 =&gt; ["finding"=&gt;""]
                              ],
                              [
                                  1 =&gt; ["finding"=&gt;""]
                              ]
                          ]
                      ],
                      [
                          0 =&gt; ["finding"=&gt;""]
                      ],
                      [
                          1 =&gt; ["finding"=&gt;""]
                      ]
                  ]
  </code></pre>
  
  <p>Please help me to fix this, as 1st scenario always gives error for scenario second and vice versa.</p>