I use Laravel-5.0 by default, AuthenticationMiddleware, but I changed the descriptor function signature to have:
public function handle($request, Closure $next, AuthClientInterface $authClient)
I also registered AuthClientInterfacewith the service provider:
public function register()
{
$this->app->bind('App\Services\Contracts\AuthClientInterface', function()
{
return new AuthClient(
env('AUTH_SERVER_URL'),
env('AUTH_SESSION_URL'),
env('AUTH_CLIENT_ID')
);
});
}
However, despite this, I see the following error:
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...
Can anyone see what I'm doing wrong?
EDIT: I got the job by passing HelioAuthClientInterface to the middleware constructor. However, I thought that the IoC container would also add dependency to methods in addition to the constructor.
source
share