Laravel Dependency Injection in Middleware
<p>I am using Laravel-5.0's default <code>Authentication</code> Middleware, but I changed the signature of the handle function to have:</p>

<pre><code>public function handle($request, Closure $next, AuthClientInterface $authClient)
</code></pre>

<p>I also registered <code>AuthClientInterface</code> in a Service Provider with:</p>

<pre><code>public function register()
{
    $this-&gt;app-&gt;bind('App\Services\Contracts\AuthClientInterface', function()
    {
        return new AuthClient(
            env('AUTH_SERVER_URL'),
            env('AUTH_SESSION_URL'),
            env('AUTH_CLIENT_ID')
        );
    });
}
</code></pre>

<p>However, despite this, I am see the following error:</p>

<pre><code>Argument 3 passed to HelioQuote\Http\Middleware\Authenticate::handle() 
must be an instance of 
HelioQuote\Services\Contracts\HelioAuthClientInterface, none given, 
called in C:\MyApp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php on line 125 and defined...
</code></pre>

<p>Can anyone see what I am doing wrong?</p>

<p>EDIT:  I did get it working by passing the HelioAuthClientInterface into the constructor of the middleware.  However I thought the IoC container would also inject the dependency to methods in addition to the constructor.</p>