registerConfig(); $this->registerViews(); $this->registerFactories(); $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); $this->hooks(); } /** * Module hooks. */ public function hooks() { } /** * Register the service provider. * * @return void */ public function register() { $this->registerTranslations(); } /** * Register config. * * @return void */ protected function registerConfig() { $this->publishes([ __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), ], 'config'); $this->mergeConfigFrom( __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' ); } /** * Register views. * * @return void */ public function registerViews() { $viewPath = resource_path('views/modules/$LOWER_NAME$'); $sourcePath = __DIR__.'/../$PATH_VIEWS$'; $this->publishes([ $sourcePath => $viewPath ],'views'); $this->loadViewsFrom(array_merge(array_map(function ($path) { return $path . '/modules/$LOWER_NAME$'; }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); } /** * Register translations. * * @return void */ public function registerTranslations() { $this->loadJsonTranslationsFrom(__DIR__ .'/../$PATH_LANG$'); } /** * Register an additional directory of factories. * @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66 */ public function registerFactories() { if (! app()->environment('production')) { app(Factory::class)->load(__DIR__ . '/../$FACTORIES_PATH$'); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return []; } }