registerTranslations(); $this->registerConfig(); $this->registerViews(); } /** * Register the service provider. * * @return void */ public function register() { } /** * Register config. * * @return void */ protected function registerConfig() { $this->publishes([ __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php' => config_path('gallery.php'), ]); $this->mergeConfigFrom(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php', 'gallery'); } /** * Register views. * * @return void */ public function registerViews() { $viewPath = base_path('resources' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery'); $sourcePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'views'; $this->publishes([$sourcePath => $viewPath], 'module-views'); $this->loadViewsFrom(array_merge(array_map(function ($path) { return $path . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . '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/adminMenu.templatePath'); } catch (InvalidArgumentException $e) { // ignore this exception } } /** * Register translations. * * @return void */ public function registerTranslations() { $langPath = base_path('resources' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'gallery'); if (is_dir($langPath)) { $this->loadTranslationsFrom($langPath, 'gallery'); } else { $this->loadTranslationsFrom(__DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'lang', 'gallery'); } } /** * Get the services provided by the provider. * * @return array */ public function provides() { return array (); } }