FEATURE #1394: init static page module

Module is now installed and ready to be used
This commit is contained in:
Michal Kváček
2016-01-27 15:28:41 +01:00
parent 79d5277a13
commit 35a93091ff
5 changed files with 44 additions and 11 deletions
@@ -1,5 +1,7 @@
<?php namespace Modules\Staticpages\Providers;
use App\Enumerations\Modules;
use App\Models\Module;
use Illuminate\Support\ServiceProvider;
class StaticPagesServiceProvider extends ServiceProvider
@@ -18,6 +20,7 @@ class StaticPagesServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->install();
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
@@ -40,6 +43,24 @@ class StaticPagesServiceProvider extends ServiceProvider
//
}
/**
* Method for installing module into database
*/
protected function install()
{
$handler = '\\Modules\\StaticPages\\Handlers\\StaticPage';
$installedModules = Modules::getWithTranslations();
if (!isset($installedModules[$handler])) {
// insert module into database
Module::create([
'handler' => $handler,
'name' => 'staticpages::module.name',
'description' => 'staticpages::module.description'
]);
}
}
/**
* Register config.
*
@@ -82,14 +103,4 @@ class StaticPagesServiceProvider extends ServiceProvider
{
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'staticpages');
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
}