title: Validating required_with and additional rules
body: <p>I need to setup a validation rule for two date fields <strong>arrivalFrom</strong> and <strong>arrivalTo</strong>. The fields are optional, but if one of the fields are present the other is required, and should follow a specific format. </p>
  
  <pre><code>// Validation.
  $validator = Validator::make($request-&gt;all(), [
      'amount'      =&gt; 'required|numeric',
      'arrivalFrom' =&gt; 'required_with:arrivalTo|date_format:dd/mm/yy|before:arrivalTo',
      'arrivalTo'   =&gt; 'required_with:arrivalFrom|date_format:dd/mm/yy|before:arrivalFrom',
  ]);
  </code></pre>
  
  <p>The validation works if the only rule set is "required_with" but as soon as <em>date_format</em> or <em>before</em> is set, the <em>required_with</em> is ignored. </p>
  
  <pre><code>Validation Message
  Please not that neither of the fields "arrivalFrom" / "arrivalTo" are set.
      The arrival from does not match the format dd/mm/yy.
      The arrival from must be a date before arrival to. 
      The arrival to does not match the format dd/mm/yy.
      The arrival to must be a date before arrival to. 
  </code></pre>
  
  <p>Is there a way to achieve these validation in one go, instead of checking if the input is present and then set validation rules.  </p>
  
  <p>I'm using Laravel 5.4.</p>
  
  <p><strong>EDIT : Solution</strong></p>
  
  <pre><code>// Validation.
  $validator = Validator::make($request-&gt;all(), [
      'amount' =&gt; 'required|numeric',
      'arrivalFrom' =&gt; 'required_with:arrivalTo|nullable|date_format:d/m/y|before:arrivalTo',
      'arrivalTo' =&gt; 'required_with:arrivalFrom|nullable|date_format:d/m/y|after:arrivalFrom',
  ]);
  </code></pre>