1 | <?php |
||
19 | class LaravelSocialServiceProvider extends ServiceProvider |
||
20 | { |
||
21 | use DetectsApplicationNamespace; |
||
22 | |||
23 | /** |
||
24 | * Enabled social providers. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | public $enabled = ['Github','Facebook','Google','Twitter', 'Linkedin']; |
||
29 | |||
30 | /** |
||
31 | * Register the application services. |
||
32 | */ |
||
33 | public function register() |
||
34 | { |
||
35 | if (!defined('LARAVELSOCIAL_PATH')) { |
||
36 | define('LARAVELSOCIAL_PATH', realpath(__DIR__.'/../../')); |
||
37 | } |
||
38 | |||
39 | if ($this->app->runningInConsole()) { |
||
40 | $this->commands([\Acacha\LaravelSocial\Console\Commands\Social::class]); |
||
41 | $this->commands([\Acacha\LaravelSocial\Console\Commands\MakeSocial::class]); |
||
42 | } |
||
43 | |||
44 | $this->app->bind('LaravelSocial', function () { |
||
45 | return new \Acacha\LaravelSocial\LaravelSocial(); |
||
46 | }); |
||
47 | |||
48 | $this->registerSocialiteProvider(); |
||
49 | |||
50 | $this->registerSocialProviderManager(); |
||
51 | |||
52 | $this->registerConfigureSocialServicesManager(); |
||
53 | |||
54 | $this->registerOAuthApp(); |
||
55 | |||
56 | $this->registerSocialProviders(); |
||
57 | |||
58 | $this->registerLaravelSocialiteService(); |
||
59 | |||
60 | $this->registerSocialUsersRepository(); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Bootstrap the application services. |
||
65 | */ |
||
66 | public function boot() |
||
67 | { |
||
68 | $this->defineRoutes(); |
||
69 | $this->loadMigrations(); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * Define the AdminLTETemplate routes. |
||
74 | */ |
||
75 | protected function defineRoutes() |
||
76 | { |
||
77 | if (!$this->app->routesAreCached()) { |
||
78 | $router = app('router'); |
||
79 | |||
80 | $router->group(['namespace' => 'Acacha\LaravelSocial\Http\Controllers'], function () { |
||
81 | require __DIR__.'/../Http/routes.php'; |
||
82 | }); |
||
83 | } |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Register social provider manager. |
||
88 | */ |
||
89 | private function registerSocialProviderManager() |
||
90 | { |
||
91 | $this->app->singleton(\Acacha\LaravelSocial\Contracts\Factory::class, function ($app) { |
||
92 | return new SocialProviderManager($app); |
||
93 | }); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Register socialite service provider. |
||
98 | */ |
||
99 | private function registerSocialiteProvider() |
||
103 | |||
104 | /** |
||
105 | * Register configure social services manager. |
||
106 | */ |
||
107 | private function registerConfigureSocialServicesManager() |
||
108 | { |
||
109 | $this->app->singleton( |
||
110 | \Acacha\LaravelSocial\Contracts\ConfigureSocialServicesFactory::class, |
||
111 | function ($app) { |
||
112 | return new ConfigureSocialServicesManager($app); |
||
113 | } |
||
114 | ); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Register OAuth App. |
||
119 | */ |
||
120 | private function registerOAuthApp() |
||
125 | |||
126 | /** |
||
127 | * Register Laravel Socialite service. |
||
128 | */ |
||
129 | private function registerLaravelSocialiteService() |
||
130 | { |
||
131 | $this->app->bind(\Acacha\LaravelSocial\Services\LaravelSocialiteService::class, function ($app) { |
||
|
|||
132 | return new LaravelSocialiteService( |
||
133 | new \Acacha\Filesystem\Compiler\StubFileCompiler(), |
||
134 | new \Acacha\Filesystem\Filesystem() |
||
135 | ); |
||
136 | }); |
||
137 | } |
||
138 | |||
139 | /** |
||
140 | * Register social providers. |
||
141 | */ |
||
142 | private function registerSocialProviders() |
||
152 | |||
153 | /** |
||
154 | * Load migrations. |
||
155 | */ |
||
156 | private function loadMigrations() |
||
160 | |||
161 | /** |
||
162 | * Register social users repository. |
||
163 | */ |
||
164 | private function registerSocialUsersRepository() |
||
171 | } |
||
172 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.