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 <?php
return [ return [
'name' => 'StaticPages', 'name' => 'StaticPages',
'description' => '', 'translatedName' => 'staticpages::module.name',
'handler' => '\\Modules\\StaticPages\\Handlers\\StaticPage', 'translatedDescription' => 'staticpages::module.description',
'providers' => [\Modules\Staticpages\Providers\StaticPagesServiceProvider::class], 'alias' => 'staticpages',
'keywords' => [], 'handler' => '\\Modules\\StaticPages\\Handlers\\StaticPage',
'files' => ['start.php'], 'providers' => [\Modules\Staticpages\Providers\StaticPagesServiceProvider::class],
'order' => 0, 'files' => ['start.php'],
'order' => 0,
]; ];
@@ -86,4 +86,14 @@ class StaticPage extends Handler
return 0; return 0;
} }
/**
* Install module
*
* @return mixed
*/
public static function install()
{
// nothing to do
}
} }
@@ -27,8 +27,6 @@ class StaticPagesServiceProvider extends ServiceProvider
$this->registerTranslations(); $this->registerTranslations();
$this->registerConfig(); $this->registerConfig();
$this->registerViews(); $this->registerViews();
$this->install();
} }
/** /**
@@ -42,52 +40,17 @@ class StaticPagesServiceProvider extends ServiceProvider
$this->app->register('Modules\StaticPages\Providers\EventServiceProvider'); $this->app->register('Modules\StaticPages\Providers\EventServiceProvider');
} }
/** // /**
* Method for installing module into database // * Method for installing module into database
*/ // */
protected function install() // protected function install()
{ // {
$handler = config('staticpages.handler'); // $handler = config('staticpages.handler');
$installedModules = ModulesHandlerToId::getWithTranslations(); // $installedModules = ModulesHandlerToId::getWithTranslations();
if (!isset($installedModules[$handler])) { // if (!isset($installedModules[$handler])) {
// Module::install('staticpages::module.name', 'staticpages', 'staticpages::module.description');
// 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'
// ]);
}
}
/** /**
* Register config. * Register config.
View File