title: validation depends on radio button selection laravel
body: <p>I have different inputs depends on radio buttons. How to validate them according to selection?</p>
  <pre class="lang-php prettyprint-override"><code>&lt;div class=&quot;sm:col-span-2&quot;&gt;
      &lt;div class=&quot;mt-4&quot;&gt;
          &lt;nav class=&quot; &quot; aria-label=&quot;Tabs&quot;&gt;
              &lt;div class=&quot;border-gray-300 border-2 rounded-lg pl-3 py-2 w-40&quot; :class=&quot;tab == 'tab1' ? ' bg-green-200 border-green-500 ' : ''&quot;&gt;
              &lt;input type=&quot;radio&quot; @click=&quot;tab = 'tab1'&quot;  checked=&quot;tab == 'tab1' ? true: false&quot; name=&quot;person_company&quot;&gt; &lt;span class=&quot;text-gray-600  font-medium text-sm pl-2&quot;&gt;person&lt;/span&gt; &lt;/input&gt; 
              &lt;/div&gt;
              &lt;br&gt;
              &lt;div class=&quot;border-gray-300 border-2 rounded-lg pl-3 py-2 w-40&quot; :class=&quot;tab == 'tab2' ? ' bg-green-200 border-green-500 ' : '  '&quot;&gt;
              &lt;input type=&quot;radio&quot; @click=&quot;tab = 'tab2'&quot;   name=&quot;person_company&quot;&gt; &lt;span class=&quot;text-gray-600  font-medium text-sm pl-2&quot;&gt;company&lt;/span&gt; &lt;/input&gt;
              &lt;/div&gt;                                    
          &lt;/nav&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;sm:col-span-2 &quot; x-show=&quot;tab == 'tab1'&quot;&gt;
      &lt;label for=&quot;identity_no&quot; class=&quot;block text-sm font-medium text-gray-700&quot;&gt;Identity&lt;/label&gt;
      &lt;div class=&quot;mt-1&quot;&gt;
          &lt;input type=&quot;text&quot; name=&quot;identity_no&quot; id=&quot;identity_no&quot; class=&quot;block w-full py-4 border-gray-300 rounded-md shadow-sm focus:ring-green-500 focus:border-green-500 sm:text-sm&quot;&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;sm:col-span-2&quot; x-show=&quot;tab == 'tab2'&quot;&gt;
      &lt;label for=&quot;company&quot; class=&quot;block text-sm font-medium text-gray-700&quot;&gt;Company name&lt;/label&gt;
      &lt;div class=&quot;mt-1&quot;&gt;
          &lt;input type=&quot;text&quot; name=&quot;company&quot; id=&quot;company&quot; class=&quot;block w-full py-4 border-gray-300 rounded-md shadow-sm focus:ring-green-500 focus:border-green-500 sm:text-sm&quot;&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>this code needs both of them that's not what I want</p>
  <pre class="lang-php prettyprint-override"><code>$this-&gt;validate($request,[
              'identity' =&gt; 'required', 
              'company' =&gt; 'required',
          ]);
  </code></pre>