diff --git a/src/Commands/stubs/scaffold/provider.stub b/src/Commands/stubs/scaffold/provider.stub index c1961db09..0a6e9a8aa 100644 --- a/src/Commands/stubs/scaffold/provider.stub +++ b/src/Commands/stubs/scaffold/provider.stub @@ -5,6 +5,8 @@ namespace $NAMESPACE$; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class $CLASS$ extends ServiceProvider { @@ -76,8 +78,23 @@ class $CLASS$ extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, '$PATH_CONFIG$/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, '$PATH_CONFIG$/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt index c1dfd76b7..502378c68 100644 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_disable__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt index abce8e6c9..fd27431fc 100644 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generate_module_when_provider_is_enable_and_route_provider_is_enable__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt index abce8e6c9..fd27431fc 100644 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_api_module_with_resources__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt index 338ac54dc..624b86d23 100644 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_namespace_using_studly_case__1.txt @@ -5,6 +5,8 @@ namespace Modules\ModuleName\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class ModuleNameServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class ModuleNameServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt index abce8e6c9..fd27431fc 100644 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_module_resources__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt index abce8e6c9..fd27431fc 100644 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt index abce8e6c9..fd27431fc 100644 --- a/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt +++ b/tests/Commands/Make/__snapshots__/ModuleMakeCommandTest__test_it_generates_web_module_with_resources_when_adding_more_than_one_option__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt index 51d1998c4..e13cd1f68 100644 --- a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt +++ b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\SuperProviders; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt index 51d1998c4..e13cd1f68 100644 --- a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt +++ b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_change_the_default_namespace_specific__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\SuperProviders; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt index 03a3e9d8d..705d88db2 100644 --- a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt +++ b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_can_have_custom_migration_resources_location_paths__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /** diff --git a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generates_a_master_service_provider_with_resource_loading__1.txt b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generates_a_master_service_provider_with_resource_loading__1.txt index abce8e6c9..fd27431fc 100644 --- a/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generates_a_master_service_provider_with_resource_loading__1.txt +++ b/tests/Commands/Make/__snapshots__/ProviderMakeCommandTest__test_it_generates_a_master_service_provider_with_resource_loading__1.txt @@ -5,6 +5,8 @@ namespace Modules\Blog\Providers; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Nwidart\Modules\Traits\PathNamespace; +use RecursiveDirectoryIterator; +use RecursiveIteratorIterator; class BlogServiceProvider extends ServiceProvider { @@ -76,8 +78,23 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->name, 'config/config.php') => config_path($this->nameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->name, 'config/config.php'), $this->nameLower); + $relativeConfigPath = config('modules.paths.generator.config.path'); + $configPath = module_path($this->name, $relativeConfigPath); + + if (is_dir($configPath)) { + $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configPath)); + + foreach ($iterator as $file) { + if ($file->isFile() && $file->getExtension() === 'php') { + $relativePath = str_replace($configPath . DIRECTORY_SEPARATOR, '', $file->getPathname()); + $configKey = $this->nameLower . '.' . str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $relativePath); + $key = ($relativePath === 'config.php') ? $this->nameLower : $configKey; + + $this->publishes([$file->getPathname() => config_path($relativePath)], $configPath); + $this->mergeConfigFrom($file->getPathname(), $key); + } + } + } } /**