Created
March 13, 2014 08:39
-
-
Save assertchris/9524459 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Tricks\Providers; | |
use Tricks\Services\Social\Disqus; | |
use Tricks\Services\Social\Github; | |
use Illuminate\Support\ServiceProvider; | |
use Guzzle\Service\Client as GuzzleClient; | |
use League\OAuth2\Client\Provider\Github as GithubProvider; | |
class SocialServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register the service provider. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
$this->registerGithub(); | |
$this->registerDisqus(); | |
} | |
/** | |
* Register the Github services. | |
* | |
* @return void | |
*/ | |
protected function registerGithub() | |
{ | |
$this->app['github.provider'] = $this->app->share(function ($app) { | |
return new GithubProvider($app['config']->get('social.github')); | |
}); | |
$this->app['github'] = $this->app->share(function ($app) { | |
$provider = $app['github.provider']; | |
$config = $app['config']; | |
$users = $app->make('Tricks\Repositories\UserRepositoryInterface'); | |
$profiles = $app->make('Tricks\Repositories\ProfileRepositoryInterface'); | |
return new Github($provider, $config, $users, $profiles); | |
}); | |
} | |
/** | |
* Register the Disqus service. | |
* | |
* @return void | |
*/ | |
protected function registerDisqus() | |
{ | |
$this->app['disqus'] = $this->app->share(function ($app) { | |
$config = $app['config']; | |
$client = new GuzzleClient($config->get('social.disqus.requestUrl')); | |
return new Disqus($client, $config); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment