From bee7e732ccf06ca78916eaf967cbffe3af302b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Mon, 14 Mar 2016 13:16:04 +0100 Subject: [PATCH] FEATURE: move module configuration into database --- modules/StaticPages/Config/config.php | 15 ++--- modules/StaticPages/Handlers/StaticPage.php | 10 ++++ .../Providers/StaticPagesServiceProvider.php | 59 ++++--------------- public/modules/staticpages/.gitkeep | 0 4 files changed, 29 insertions(+), 55 deletions(-) create mode 100644 public/modules/staticpages/.gitkeep diff --git a/modules/StaticPages/Config/config.php b/modules/StaticPages/Config/config.php index 67df171e..d547f1ce 100644 --- a/modules/StaticPages/Config/config.php +++ b/modules/StaticPages/Config/config.php @@ -1,11 +1,12 @@ 'StaticPages', - 'description' => '', - 'handler' => '\\Modules\\StaticPages\\Handlers\\StaticPage', - 'providers' => [\Modules\Staticpages\Providers\StaticPagesServiceProvider::class], - 'keywords' => [], - 'files' => ['start.php'], - 'order' => 0, + 'name' => 'StaticPages', + 'translatedName' => 'staticpages::module.name', + 'translatedDescription' => 'staticpages::module.description', + 'alias' => 'staticpages', + 'handler' => '\\Modules\\StaticPages\\Handlers\\StaticPage', + 'providers' => [\Modules\Staticpages\Providers\StaticPagesServiceProvider::class], + 'files' => ['start.php'], + 'order' => 0, ]; \ No newline at end of file diff --git a/modules/StaticPages/Handlers/StaticPage.php b/modules/StaticPages/Handlers/StaticPage.php index d1657f28..fd058710 100644 --- a/modules/StaticPages/Handlers/StaticPage.php +++ b/modules/StaticPages/Handlers/StaticPage.php @@ -86,4 +86,14 @@ class StaticPage extends Handler return 0; } + + /** + * Install module + * + * @return mixed + */ + public static function install() + { + // nothing to do + } } \ No newline at end of file diff --git a/modules/StaticPages/Providers/StaticPagesServiceProvider.php b/modules/StaticPages/Providers/StaticPagesServiceProvider.php index 9255500b..356656db 100644 --- a/modules/StaticPages/Providers/StaticPagesServiceProvider.php +++ b/modules/StaticPages/Providers/StaticPagesServiceProvider.php @@ -27,8 +27,6 @@ class StaticPagesServiceProvider extends ServiceProvider $this->registerTranslations(); $this->registerConfig(); $this->registerViews(); - - $this->install(); } /** @@ -42,52 +40,17 @@ class StaticPagesServiceProvider extends ServiceProvider $this->app->register('Modules\StaticPages\Providers\EventServiceProvider'); } - /** - * Method for installing module into database - */ - protected function install() - { - $handler = config('staticpages.handler'); - $installedModules = ModulesHandlerToId::getWithTranslations(); - if (!isset($installedModules[$handler])) { - - // insert module into database - Module::create([ - 'handler' => $handler, - 'name' => 'staticpages::module.name', - 'description' => 'staticpages::module.description', - 'alias' => 'staticpages' - ]); - - // insert action log types into database -// ActionLogType::create([ -// 'string_id' => 'staticpages::createNew', -// 'name' => 'staticpages::log.nameCreateNew', -// 'value' => 'staticpages::log.nameCreateNew' -// ]); -// ActionLogType::create([ -// 'string_id' => 'staticpages::edit', -// 'name' => 'staticpages::log.nameEdit', -// 'value' => 'staticpages::log.edit' -// ]); -// ActionLogType::create([ -// 'string_id' => 'staticpages::delete', -// 'name' => 'staticpages::log.nameDelete', -// 'value' => 'staticpages::log.delete' -// ]); -// ActionLogType::create([ -// 'string_id' => 'staticpages::makeDraft', -// 'name' => 'staticpages::log.nameMakeDraft', -// 'value' => 'staticpages::log.makeDraft' -// ]); -// -// ActionLogType::create([ -// 'string_id' => 'staticpages::publish', -// 'name' => 'staticpages::log.namePublish', -// 'value' => 'staticpages::log.publish' -// ]); - } - } +// /** +// * Method for installing module into database +// */ +// protected function install() +// { +// $handler = config('staticpages.handler'); +// $installedModules = ModulesHandlerToId::getWithTranslations(); +// if (!isset($installedModules[$handler])) { +// Module::install('staticpages::module.name', 'staticpages', 'staticpages::module.description'); +// } +// } /** * Register config. diff --git a/public/modules/staticpages/.gitkeep b/public/modules/staticpages/.gitkeep new file mode 100644 index 00000000..e69de29b