title: Using ValidatesRequests trait in Laravel
body: <p>Here's the code from my <code>AuthController</code>:</p>
  
  <pre><code>public function postRegister(Request $request)
  {
      $this-&gt;validate($request, [
          'name' =&gt; 'required|min:3',
          'email' =&gt; 'required|email|unique:users',
          'password' =&gt; 'required|min:5|max:15',
      ]);
  }
  </code></pre>
  
  <p>If the validation fails I'm getting redirected to the previous page. Is there a way to pass additional data along with the input and the errors (which are handled by the trait)?</p>
  
  <p><strong>Edit</strong>: Actually, the trait does exactly what I want, except the additional data I want to pass. As @CDF suggested in the answers I should modify the <code>buildFailedValidationResponse</code> method which is <code>protected</code>. </p>
  
  <p>Should I create a new custom trait, which will have the same functionality as the <code>ValidatesRequests</code> trait (that comes with Laravel) and edit the <code>buildFailedValidationResponse</code> method to accept one more argument <strong>or</strong> traits can be easily modified following another approach (if any exists)?</p>