@@ -23,7 +23,7 @@ public function boot()
2323 $ this ->loadViewsFrom (__DIR__ .'/../../views ' , 'stream-laravel ' );
2424
2525 $ this ->publishes ([
26- __DIR__ .'/../../config/config.php ' => config_path ('getstream .php ' ),
26+ __DIR__ .'/../../config/config.php ' => config_path ('stream-laravel .php ' ),
2727 __DIR__ .'/../../views ' => base_path ('resources/views/vendor/stream-laravel ' ),
2828 ]);
2929 }
@@ -35,21 +35,43 @@ public function boot()
3535 */
3636 public function register ()
3737 {
38- $ this ->mergeConfigFrom (
39- __DIR__ .'/../../config/config.php ' , 'stream-laravel '
40- );
38+
39+ $ this ->registerResources ();
4140
4241 $ this ->app ['feed_manager ' ] = $ this ->app ->share (function ($ app )
4342 {
4443
45- $ manager_class = config ('stream-laravel. feed_manager_class ' );
46- $ api_key = config ('stream-laravel. api_key ' );
47- $ api_secret = config ('stream-laravel. api_secret ' );
44+ $ manager_class = $ app [ ' config ' ]-> get ('stream-laravel:: feed_manager_class ' );
45+ $ api_key = $ app [ ' config ' ]-> get ('stream-laravel:: api_key ' );
46+ $ api_secret = $ app [ ' config ' ]-> get ('stream-laravel:: api_secret ' );
4847
49- return new $ manager_class ($ api_key , $ api_secret , $ app ['config ' ]);
48+ return new $ manager_class ($ api_key , $ api_secret , $ this -> app ['config ' ]);
5049 });
5150 }
5251
52+ /**
53+ * Register the package resources.
54+ *
55+ * @return void
56+ */
57+ protected function registerResources ()
58+ {
59+ $ userConfigFile = app ()->configPath ().'/stream-laravel.php ' ;
60+ $ packageConfigFile = __DIR__ .'/../../config/config.php ' ;
61+ $ config = $ this ->app ['files ' ]->getRequire ($ packageConfigFile );
62+
63+ if (file_exists ($ userConfigFile )) {
64+ $ userConfig = $ this ->app ['files ' ]->getRequire ($ userConfigFile );
65+ $ config = array_replace_recursive ($ config , $ userConfig );
66+ }
67+
68+ $ namespace = 'stream-laravel:: ' ;
69+
70+ foreach ($ config as $ key => $ value ) {
71+ $ this ->app ['config ' ]->set ($ namespace . $ key , $ value );
72+ }
73+ }
74+
5375 /**
5476 * Get the services provided by the provider.
5577 *
0 commit comments