title: Checking if there is any validation error when using custom form request class
body: <p>I am using Laravel 5.4. I have a custom form request class where I have my validation rules and messages and I use it in my controller like following :</p>
  
  <pre><code>public function store(CustomFormRequest $request)
  {
    //
  }
  </code></pre>
  
  <p>I am using ajax to send the request and when there is any validation error, Laravel throws an error with an HTTP response with a 422 status code including a JSON representation of the validation errors.</p>
  
  <p>But I don't want that. Instead, inside my controller's method, I want to find out if there is any validation error and if there is any then I want to return a response with some additional data along with the validation messages, like this:</p>
  
  <pre><code>// Inside my Controller
  public function store(CustomFormRequest $request)
  {
     if ($validator-&gt;fails())
     {
          $errors = $validator-&gt;errors();
  
          return response()-&gt;json(array('status' =&gt; 2, 'msg' =&gt; $errors-&gt;all() ));
      }
  }
  </code></pre>
  
  <p>Could you please help ?
  Thanks in advance.</p>