diff --git a/src/Commands/stubs/scaffold/provider.stub b/src/Commands/stubs/scaffold/provider.stub index 7199be96a..c1961db09 100644 --- a/src/Commands/stubs/scaffold/provider.stub +++ b/src/Commands/stubs/scaffold/provider.stub @@ -10,9 +10,9 @@ class $CLASS$ extends ServiceProvider { use PathNamespace; - protected string $moduleName = '$MODULE$'; + protected string $name = '$MODULE$'; - protected string $moduleNameLower = '$LOWER_NAME$'; + protected string $nameLower = '$LOWER_NAME$'; /** * Boot the application events. @@ -24,7 +24,7 @@ class $CLASS$ extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, '$MIGRATIONS_PATH$')); + $this->loadMigrationsFrom(module_path($this->name, '$MIGRATIONS_PATH$')); } /** @@ -60,14 +60,14 @@ class $CLASS$ extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, '$PATH_LANG$'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, '$PATH_LANG$')); + $this->loadTranslationsFrom(module_path($this->name, '$PATH_LANG$'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, '$PATH_LANG$')); } } @@ -76,8 +76,8 @@ class $CLASS$ extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, '$PATH_CONFIG$/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, '$PATH_CONFIG$/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class $CLASS$ extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, '$PATH_VIEWS$'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, '$PATH_VIEWS$'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 cd8b623df..c1dfd76b7 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 62bd6a496..abce8e6c9 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 62bd6a496..abce8e6c9 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 f6c99ebc3..338ac54dc 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 @@ -10,9 +10,9 @@ class ModuleNameServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'ModuleName'; + protected string $name = 'ModuleName'; - protected string $moduleNameLower = 'modulename'; + protected string $nameLower = 'modulename'; /** * Boot the application events. @@ -24,7 +24,7 @@ class ModuleNameServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class ModuleNameServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class ModuleNameServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class ModuleNameServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 62bd6a496..abce8e6c9 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 62bd6a496..abce8e6c9 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 62bd6a496..abce8e6c9 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 86ef5859a..51d1998c4 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 86ef5859a..51d1998c4 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 991b8969b..03a3e9d8d 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } } 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 62bd6a496..abce8e6c9 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 @@ -10,9 +10,9 @@ class BlogServiceProvider extends ServiceProvider { use PathNamespace; - protected string $moduleName = 'Blog'; + protected string $name = 'Blog'; - protected string $moduleNameLower = 'blog'; + protected string $nameLower = 'blog'; /** * Boot the application events. @@ -24,7 +24,7 @@ class BlogServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - $this->loadMigrationsFrom(module_path($this->moduleName, 'database/migrations')); + $this->loadMigrationsFrom(module_path($this->name, 'database/migrations')); } /** @@ -60,14 +60,14 @@ class BlogServiceProvider extends ServiceProvider */ public function registerTranslations(): void { - $langPath = resource_path('lang/modules/'.$this->moduleNameLower); + $langPath = resource_path('lang/modules/'.$this->nameLower); if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadTranslationsFrom($langPath, $this->nameLower); $this->loadJsonTranslationsFrom($langPath); } else { - $this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower); - $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang')); + $this->loadTranslationsFrom(module_path($this->name, 'lang'), $this->nameLower); + $this->loadJsonTranslationsFrom(module_path($this->name, 'lang')); } } @@ -76,8 +76,8 @@ class BlogServiceProvider extends ServiceProvider */ protected function registerConfig(): void { - $this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config'); - $this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower); + $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); } /** @@ -85,36 +85,31 @@ class BlogServiceProvider extends ServiceProvider */ public function registerViews(): void { - $viewPath = resource_path('views/modules/'.$this->moduleNameLower); - $sourcePath = module_path($this->moduleName, 'resources/views'); + $viewPath = resource_path('views/modules/'.$this->nameLower); + $sourcePath = module_path($this->name, 'resources/views'); - $this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']); + $this->publishes([$sourcePath => $viewPath], ['views', $this->nameLower.'-module-views']); - $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->nameLower); - $componentNamespace = $this->module_namespace($this->moduleName, $this->app_path(config('modules.paths.generator.component-class.path'))); - Blade::componentNamespace($componentNamespace, $this->moduleNameLower); + $componentNamespace = $this->module_namespace($this->name, $this->app_path(config('modules.paths.generator.component-class.path'))); + Blade::componentNamespace($componentNamespace, $this->nameLower); } /** * Get the services provided by the provider. - * - * @return array */ public function provides(): array { return []; } - /** - * @return array - */ private function getPublishableViewPaths(): array { $paths = []; foreach (config('view.paths') as $path) { - if (is_dir($path.'/modules/'.$this->moduleNameLower)) { - $paths[] = $path.'/modules/'.$this->moduleNameLower; + if (is_dir($path.'/modules/'.$this->nameLower)) { + $paths[] = $path.'/modules/'.$this->nameLower; } }