Support the ongoing development of Laravel.io →
posted 9 years ago
IOC
Last updated 2 years ago.
0

So, I was thinking and realized that it's a pretty stupid way to use the Service Container, not really the way it's supposed to be. So what I did was this:

Rewrite the bindCLass() function:

	private function bindClass()
	{
		foreach ( \Config::get('social-auth.providers') as $name => $provider )
		{
			$this->app->bind('SocialAuth\\' . $name, $provider);
		}
	}

Now it binds all the providers into the service container.

Hence, here's the resolver inside the controller:

    private function resolve($provider)
    {
        $this->provider = \App::make('SocialAuth\\' . ucfirst($provider));
    }

Like this it all works and makes some more sense.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.