Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/Commands/stubs/scaffold/provider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class $CLASS$ extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class ModuleNameServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ class BlogServiceProvider extends ServiceProvider
$config = str_replace($configPath.DIRECTORY_SEPARATOR, '', $file->getPathname());
$config_key = str_replace([DIRECTORY_SEPARATOR, '.php'], ['.', ''], $config);
$segments = explode('.', $this->nameLower.'.'.$config_key);

// Remove duplicated adjacent segments
$normalized = [];
foreach ($segments as $segment) {
Expand All @@ -99,13 +98,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,24 @@ class BlogServiceProvider extends ServiceProvider

$key = ($config === 'config.php') ? $this->nameLower : implode('.', $normalized);

$this->publishes([$file->getPathname() => config_path($config)], 'config');
$this->mergeConfigFrom($file->getPathname(), $key);
$this->publishes([$file->getPathname() => config_path($relativePath)], 'config');
$this->merge_config_from($file->getPathname(), $key);
}
}
}
}

/**
* Merge config from the given path recursively.
*/
protected function merge_config_from(string $path, string $key): void
{
$existing = config($key, []);
$module_config = require $path;

config([$key => array_replace_recursive($existing, $module_config)]);
}

/**
* Register views.
*/
Expand Down
Loading