diff --git a/app/Handlers/Handler.php b/app/Handlers/Handler.php new file mode 100644 index 00000000..25ade56d --- /dev/null +++ b/app/Handlers/Handler.php @@ -0,0 +1,6 @@ +install(); $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); @@ -40,6 +43,24 @@ class StaticPagesServiceProvider extends ServiceProvider // } + /** + * Method for installing module into database + */ + protected function install() + { + $handler = '\\Modules\\StaticPages\\Handlers\\StaticPage'; + $installedModules = Modules::getWithTranslations(); + if (!isset($installedModules[$handler])) { + + // insert module into database + Module::create([ + 'handler' => $handler, + 'name' => 'staticpages::module.name', + 'description' => 'staticpages::module.description' + ]); + } + } + /** * Register config. * @@ -82,14 +103,4 @@ class StaticPagesServiceProvider extends ServiceProvider { $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'staticpages'); } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return []; - } } diff --git a/modules/StaticPages/Resources/lang/en/module.php b/modules/StaticPages/Resources/lang/en/module.php new file mode 100644 index 00000000..a263fd12 --- /dev/null +++ b/modules/StaticPages/Resources/lang/en/module.php @@ -0,0 +1,5 @@ + 'Static pages', + 'description' => 'Static pages are intended for displaying static content on webpage.' +]; \ No newline at end of file