FEATURE: move module configuration into database

This commit is contained in:
Michal Kváček
2016-03-14 13:16:04 +01:00
parent 892a597912
commit bee7e732cc
4 changed files with 29 additions and 55 deletions
+8 -7
View File
@@ -1,11 +1,12 @@
<?php
return [
'name' => '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,
];
@@ -86,4 +86,14 @@ class StaticPage extends Handler
return 0;
}
/**
* Install module
*
* @return mixed
*/
public static function install()
{
// nothing to do
}
}
@@ -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.