FEATURE: allow enabling of static pages via database
This commit is contained in:
@@ -2,5 +2,10 @@
|
||||
|
||||
return [
|
||||
'name' => 'StaticPages',
|
||||
'handler' => '\\Modules\\StaticPages\\Handlers\\StaticPage'
|
||||
'description' => '',
|
||||
'handler' => '\\Modules\\StaticPages\\Handlers\\StaticPage',
|
||||
'providers' => [\Modules\Staticpages\Providers\StaticPagesServiceProvider::class],
|
||||
'keywords' => [],
|
||||
'files' => ['start.php'],
|
||||
'order' => 0,
|
||||
];
|
||||
@@ -24,8 +24,9 @@ class StaticPage extends Handler
|
||||
|
||||
public static function getModuleId()
|
||||
{
|
||||
$handler = config('staticpages.handler');
|
||||
$allModules = ModulesHandlerToId::getWithTranslations();
|
||||
$moduleId = $allModules[config('staticpages.handler')];
|
||||
$moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null;
|
||||
|
||||
return $moduleId;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php namespace Modules\Staticpages\Providers;
|
||||
|
||||
use App\Enumerations\Modules;
|
||||
use App\Enumerations\ModulesHandlerToId;
|
||||
use App\Enumerations\ModulesWithIds;
|
||||
use App\Handlers\Registrators\TemplateRegistrator;
|
||||
@@ -25,10 +24,11 @@ class StaticPagesServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->install();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
|
||||
$this->install();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,36 +55,37 @@ class StaticPagesServiceProvider extends ServiceProvider
|
||||
Module::create([
|
||||
'handler' => $handler,
|
||||
'name' => 'staticpages::module.name',
|
||||
'description' => 'staticpages::module.description'
|
||||
'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'
|
||||
]);
|
||||
// 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'
|
||||
// ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "StaticPages",
|
||||
"alias": "staticpages",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"active": 1,
|
||||
"order": 0,
|
||||
"providers": [
|
||||
"Modules\\StaticPages\\Providers\\StaticPagesServiceProvider"
|
||||
],
|
||||
"aliases":{},
|
||||
"files": [
|
||||
"start.php"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user