title: Laravel - How do I inject automatically in Validation Rule Construct?
body: <p>I'm not able to inject these variables through Laravel:</p>
  
  <pre><code>//...class AllowedUsername implements Rule...
  
  public function __construct(Router $router, Filesystem $files, Repository $config)
  {
      $this-&gt;router = $router;
      $this-&gt;files = $files;
      $this-&gt;config = $config;
  }
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code> Type error: Too few arguments to function ... 0 passed in.
  </code></pre>
  
  <p>Why is Laravel not doing it automatically?</p>
  
  <pre><code>$request-&gt;validate([
              'username' =&gt; ['required', new AllowedUsername],           
          ]);
  </code></pre>