FEATURE: allow enabling of static pages via database
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => 'StaticPages',
|
'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()
|
public static function getModuleId()
|
||||||
{
|
{
|
||||||
|
$handler = config('staticpages.handler');
|
||||||
$allModules = ModulesHandlerToId::getWithTranslations();
|
$allModules = ModulesHandlerToId::getWithTranslations();
|
||||||
$moduleId = $allModules[config('staticpages.handler')];
|
$moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null;
|
||||||
|
|
||||||
return $moduleId;
|
return $moduleId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php namespace Modules\Staticpages\Providers;
|
<?php namespace Modules\Staticpages\Providers;
|
||||||
|
|
||||||
use App\Enumerations\Modules;
|
|
||||||
use App\Enumerations\ModulesHandlerToId;
|
use App\Enumerations\ModulesHandlerToId;
|
||||||
use App\Enumerations\ModulesWithIds;
|
use App\Enumerations\ModulesWithIds;
|
||||||
use App\Handlers\Registrators\TemplateRegistrator;
|
use App\Handlers\Registrators\TemplateRegistrator;
|
||||||
@@ -25,10 +24,11 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$this->install();
|
|
||||||
$this->registerTranslations();
|
$this->registerTranslations();
|
||||||
$this->registerConfig();
|
$this->registerConfig();
|
||||||
$this->registerViews();
|
$this->registerViews();
|
||||||
|
|
||||||
|
$this->install();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,36 +55,37 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
Module::create([
|
Module::create([
|
||||||
'handler' => $handler,
|
'handler' => $handler,
|
||||||
'name' => 'staticpages::module.name',
|
'name' => 'staticpages::module.name',
|
||||||
'description' => 'staticpages::module.description'
|
'description' => 'staticpages::module.description',
|
||||||
|
'alias' => 'staticpages'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// insert action log types into database
|
// insert action log types into database
|
||||||
ActionLogType::create([
|
// ActionLogType::create([
|
||||||
'string_id' => 'staticpages::createNew',
|
// 'string_id' => 'staticpages::createNew',
|
||||||
'name' => 'staticpages::log.nameCreateNew',
|
// 'name' => 'staticpages::log.nameCreateNew',
|
||||||
'value' => 'staticpages::log.nameCreateNew'
|
// 'value' => 'staticpages::log.nameCreateNew'
|
||||||
]);
|
// ]);
|
||||||
ActionLogType::create([
|
// ActionLogType::create([
|
||||||
'string_id' => 'staticpages::edit',
|
// 'string_id' => 'staticpages::edit',
|
||||||
'name' => 'staticpages::log.nameEdit',
|
// 'name' => 'staticpages::log.nameEdit',
|
||||||
'value' => 'staticpages::log.edit'
|
// 'value' => 'staticpages::log.edit'
|
||||||
]);
|
// ]);
|
||||||
ActionLogType::create([
|
// ActionLogType::create([
|
||||||
'string_id' => 'staticpages::delete',
|
// 'string_id' => 'staticpages::delete',
|
||||||
'name' => 'staticpages::log.nameDelete',
|
// 'name' => 'staticpages::log.nameDelete',
|
||||||
'value' => 'staticpages::log.delete'
|
// 'value' => 'staticpages::log.delete'
|
||||||
]);
|
// ]);
|
||||||
ActionLogType::create([
|
// ActionLogType::create([
|
||||||
'string_id' => 'staticpages::makeDraft',
|
// 'string_id' => 'staticpages::makeDraft',
|
||||||
'name' => 'staticpages::log.nameMakeDraft',
|
// 'name' => 'staticpages::log.nameMakeDraft',
|
||||||
'value' => 'staticpages::log.makeDraft'
|
// 'value' => 'staticpages::log.makeDraft'
|
||||||
]);
|
// ]);
|
||||||
|
//
|
||||||
ActionLogType::create([
|
// ActionLogType::create([
|
||||||
'string_id' => 'staticpages::publish',
|
// 'string_id' => 'staticpages::publish',
|
||||||
'name' => 'staticpages::log.namePublish',
|
// 'name' => 'staticpages::log.namePublish',
|
||||||
'value' => 'staticpages::log.publish'
|
// '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