registerTranslations(); $this->registerConfig(); $this->registerViews(); } /** * Register the service provider. * * @return void */ public function register() { // } /** * Register config. * * @return void */ protected function registerConfig() { $this->publishes([ __DIR__ . '/../Config/config.php' => config_path('gallery.php'), ]); $this->mergeConfigFrom(__DIR__ . '/../Config/config.php', 'gallery'); } /** * Register views. * * @return void */ public function registerViews() { $viewPath = base_path('resources/views/modules/gallery'); $sourcePath = __DIR__ . '/../Resources/views'; $this->publishes([ $sourcePath => $viewPath ]); $this->loadViewsFrom(array_merge(array_map(function ($path) { return $path . '/modules/gallery'; }, \Config::get('view.paths')), [$sourcePath]), 'gallery'); /** * @var $registrator TemplateRegistrator */ $registrator = $this->app->make('registerTemplateDir'); try { // setup some global variables $registrator->setBaseDirectory('resources/views/modules/gallery/visitor'); $registrator->setNamespace('gallery'); $registrator->setModuleId(call_user_func([config('gallery.handler'), 'getModuleId'])); // register path with current template name $registrator->register(config('app.theme'), 'gallery::admin.templatePath'); } catch (InvalidArgumentException $e) { // ignore this exception } } /** * Register translations. * * @return void */ public function registerTranslations() { $langPath = base_path('resources/lang/modules/gallery'); if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, 'gallery'); } else { $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'gallery'); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return array (); } }