FEATURE #1394: init static page module
Module is now installed and ready to be used
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Handlers;
|
||||||
|
|
||||||
|
abstract class Handler {
|
||||||
|
abstract public function render();
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
class Module extends Model
|
class Module extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
public $timestamps = true;
|
public $timestamps = false;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'handler',
|
'handler',
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
namespace Modules\StaticPages\Handlers;
|
||||||
|
|
||||||
|
use App\Handlers\Handler;
|
||||||
|
|
||||||
|
class StaticPage extends Handler {
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
// TODO: Implement render() method.
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php namespace Modules\Staticpages\Providers;
|
<?php namespace Modules\Staticpages\Providers;
|
||||||
|
|
||||||
|
use App\Enumerations\Modules;
|
||||||
|
use App\Models\Module;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class StaticPagesServiceProvider extends ServiceProvider
|
class StaticPagesServiceProvider extends ServiceProvider
|
||||||
@@ -18,6 +20,7 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
|
$this->install();
|
||||||
$this->registerTranslations();
|
$this->registerTranslations();
|
||||||
$this->registerConfig();
|
$this->registerConfig();
|
||||||
$this->registerViews();
|
$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.
|
* Register config.
|
||||||
*
|
*
|
||||||
@@ -82,14 +103,4 @@ class StaticPagesServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'staticpages');
|
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'staticpages');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the services provided by the provider.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function provides()
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
'name' => 'Static pages',
|
||||||
|
'description' => 'Static pages are intended for displaying static content on webpage.'
|
||||||
|
];
|
||||||
Reference in New Issue
Block a user