title: Laravel Validation: use laravel required and if exists together
body: <p>I have the following validation requirement.</p>
  
  <p>if inventory_purchase_bill == True, lines.<em>.sku should be
  required|exists:items,sku if inventory_purchase_bill == False,
  lines.</em>.sku should be nullable|exists:items,sku</p>
  
  <p>Basically test for exists only if there is a value. If no value or null then, don't check for exists.</p>
  
  <p>Tried following, but second-line overrides first. How to achieve this?</p>
  
  <pre><code>$validation = $this-&gt;validate($request, [
              'inventory_purchase_bill' =&gt; 'required',
              'lines.*.sku' =&gt; 'exclude_unless:inventory_purchase_bill,false|nullable|exists:items,sku',            
              'lines.*.sku' =&gt; 'exclude_unless:inventory_purchase_bill,true|required|exists:items,sku',            
          ]);
  </code></pre>