File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,7 @@ public function boot(): void
4949 */
5050 public function register (): void
5151 {
52- // merge package config with user defined config
53- $ this ->mergeConfigFrom (__DIR__ . '/../config/config.php ' , 'forms ' );
52+ $ this ->mergeConfig ();
5453
5554 // register the data binder
5655 $ this ->app ->singleton (FormsDataBinder::class, fn () => new FormsDataBinder ());
@@ -64,4 +63,23 @@ public function register(): void
6463 ]);
6564 }
6665 }
66+
67+ protected function mergeConfig (): void
68+ {
69+ // merge package config with user defined config
70+ $ this ->mergeConfigFrom (__DIR__ . '/../config/config.php ' , 'forms ' );
71+
72+ // Deep merge for nested 'framework' config
73+ $ default = require __DIR__ .'/../config/config.php ' ;
74+ $ default_frameworks = $ default ['frameworks ' ];
75+
76+ foreach ($ default_frameworks as $ framework => $ configs ) {
77+ $ user_config = config ('forms.frameworks. ' . $ framework );
78+
79+ config ()->set (
80+ 'forms.frameworks. ' . $ framework ,
81+ array_merge (is_array ($ user_config ) ? $ user_config : [], $ configs )
82+ );
83+ }
84+ }
6785}
You can’t perform that action at this time.
0 commit comments