title: Modify input before validation on Laravel 5.1
body: <p>I'm trying to modify an user submitted input before validation success. I've followed <a href="http://www.easylaravelbook.com/blog/2015/03/31/sanitizing-input-using-laravel-5-form-requests/" rel="noreferrer">this easy instructions</a>, but when I test it on Laravel 5.1, It's not working. <strong>Am I doing something wrong?</strong></p>
  
  <p>This is my Request class on <code>SSHAM\Http\Requests\UserCreateRequest.php</code></p>
  
  <pre><code>&lt;?php
  
  namespace SSHAM\Http\Requests;
  
  use SSHAM\Http\Requests\Request;
  
  class UserCreateRequest extends Request
  {
  
      // Some stuff not related with this problem
  
      /**
       * Get the validation rules that apply to the request.
       *
       * @return array
       */
      public function rules()
      {
          // Only for debug
          $prova = $this-&gt;all();
          echo "&lt;pre&gt;Inside Request - Before sanitize\n[" . $prova['public_key'] . "]&lt;/pre&gt;\n";
  
          // Call a function to sanitize user input
          $this-&gt;sanitize();
  
          // Only for debug    
          $prova = $this-&gt;all();
          echo "&lt;pre&gt;Inside Request - After sanitize\n[" . $prova['public_key'] . "]&lt;/pre&gt;\n";
  
          return [
              'username' =&gt; 'required|max:255|unique:users',
              'public_key' =&gt; 'openssh_key:public',
          ];
      }
  
      /**
       * Sanitizes user input. In special 'public_key' to remove carriage returns
       */
      public function sanitize()
      {
          $input = $this-&gt;all();
  
          // Removes carriage returns from 'public_key' input
          $input['public_key'] = str_replace(["\n", "\t", "\r"], '', $input['public_key']);
  
          $this-&gt;replace($input);
      }
  
  }
  </code></pre>
  
  <p>This is my custom validation rule on <code>SSHAM\Providers\OpenSSHKeyValidatorServiceProvider.php</code></p>
  
  <pre><code>&lt;?php
  
  namespace SSHAM\Providers;
  
  use Illuminate\Support\ServiceProvider;
  
  class OpenSSHKeyValidatorServiceProvider extends ServiceProvider
  {
      /**
       * Bootstrap the application services.
       *
       * @return void
       */
      public function boot()
      {
          // Registering the validator extension with the validator factory
          \Validator::extend('openssh_key', function ($attribute, $value, $parameters) {
  
              // Some stuff not related with this problem    
  
              // Only for debug
              echo "&lt;pre&gt;Inside Validator value\n[" . $value ."]&lt;/pre&gt;\n";
              dd();
  
              return true;
          });
  
      }
  
      // Some stuff not related with this problem    
  }
  </code></pre>
  
  <p>When I call for debugging I obtain this output:</p>
  
  <pre><code>Inside Request - Before sanitize
  [blah 
  second line 
  third line]
  
  Inside Request - After sanitize
  [blah second line third line]
  
  Inside Validator value
  [blah 
  second line 
  third line]
  </code></pre>
  
  <p>Seems that <code>sanitize()</code> is working, but when value is treated on validation class it has not been sanitized.</p>