title: How to ignore validation of some fields with condition in laravel
body: <p>I have an OrderRequest with these rules:</p>
  
  <pre><code>public function rules()
      {
          return [
              //
              'surname' =&gt; 'required|max:255',
              'name' =&gt; 'required|max:255',
              'city' =&gt; 'required|max:255',
              'post_office'=&gt;'required|max:255',
          ];
      }
  </code></pre>
  
  <p>I need to ignore surname and name validation if request has user_id</p>
  
  <p>Currently doing it this way:</p>
  
  <pre><code>if ((Input::has('user_id'))) {
              return [
                  //
                  'city' =&gt; 'required|max:255',
                  'post_office'=&gt;'required|max:255',
              ];
          }
          return [
              //
              'surname' =&gt; 'required|max:255',
              'name' =&gt; 'required|max:255',
              'city' =&gt; 'required|max:255',
              'post_office'=&gt;'required|max:255',
          ];
      }
  </code></pre>
  
  <p>But can I do it better way and how? </p>