Merge branch 'module_blog' into admin_theme
This commit is contained in:
@@ -56,6 +56,10 @@ abstract class Handler extends BaseHandler implements AppHandler
|
||||
// temporarily nothing to do
|
||||
}
|
||||
|
||||
public static function loadExtraData(Content $content) {
|
||||
// temporarily nothing to do
|
||||
}
|
||||
|
||||
public static function getExtendedFormInputsEdit()
|
||||
{
|
||||
return self::getExtendedFormInputsCreate();
|
||||
|
||||
@@ -73,6 +73,7 @@ class TemplateRegistrator
|
||||
public function unsetNamespace()
|
||||
{
|
||||
$this->namespace = null;
|
||||
$this->setModuleId(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,6 +96,8 @@ class TemplateRegistrator
|
||||
|
||||
// register path
|
||||
$this->registerPath($this->registeredPath, $name);
|
||||
|
||||
$this->unsetNamespace();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,6 +197,8 @@ class TemplateRegistrator
|
||||
'editable' => 1
|
||||
];
|
||||
|
||||
echo 'ukladam do db '.$templateName."\n";
|
||||
|
||||
// save template into database
|
||||
$newTemplate = Template::create($params);
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class CreateNewContent extends Controller
|
||||
$page->status = $request->status;
|
||||
$page->template = $request->template;
|
||||
$page->module_handler = $module->handler;
|
||||
$page->category_id = $request->category;
|
||||
$page->category_id = (int)$request->category > 0 ? $request->category : null;
|
||||
|
||||
if ($request->parentPage) {
|
||||
$page->parent_id = $request->parentPage;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Articles',
|
||||
'translatedName' => 'article::module.name',
|
||||
'translatedDescription' => 'article::module.description',
|
||||
'alias' => 'blog-article',
|
||||
'handler' => \Modules\Blog\Article\Handlers\Article::class,
|
||||
'providers' => [\Modules\Blog\Article\Providers\ArticleServiceProvider::class],
|
||||
'files' => ['start.php'],
|
||||
'order' => 0,
|
||||
];
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Article\Handlers;
|
||||
|
||||
use App\Enumerations\ModulesHandlerToId;
|
||||
use App\Handlers\Handler;
|
||||
use App\Http\Controllers\Admin\EditContent;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Content;
|
||||
use App\Models\User;
|
||||
|
||||
class Article extends Handler
|
||||
{
|
||||
/**
|
||||
* Render given module into visitor area.
|
||||
*
|
||||
* @param Content $content DB model from table contents
|
||||
* @param array $parameters parameters used for modifications/custom settings of given model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function render(Content $content, $parameters)
|
||||
{
|
||||
return Controller::VisitorsView($content->template, ['page' => $content]);
|
||||
}
|
||||
|
||||
public static function getExtendedFormInputsCreate()
|
||||
{
|
||||
$sections = parent::getExtendedFormInputsCreate();
|
||||
|
||||
$sections['basicInfo'] = 'article::admin.content.basicInfo';
|
||||
|
||||
return $sections;
|
||||
}
|
||||
|
||||
public static function getExtendedFormInputsEdit()
|
||||
{
|
||||
return self::getExtendedFormInputsCreate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save module-specific values into database
|
||||
*
|
||||
* @param Content $content
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
* @internal param Widget $widget
|
||||
*/
|
||||
public static function createNew(Content &$content, Request $request)
|
||||
{
|
||||
$content->module_settings = json_encode(['allowComments' => (int)$request->has('allowComments')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used for editing existing content page.
|
||||
*
|
||||
* Reason why it is separated from createNew() method is simple - we need to save history of changes.
|
||||
*
|
||||
* @param Content $content
|
||||
* @param Request $request
|
||||
*
|
||||
* @param $revisionID string ID of revision used
|
||||
*
|
||||
* @return int number of edited fields
|
||||
*/
|
||||
public static function edit(Content &$content, Request $request, $revisionID)
|
||||
{
|
||||
$fields = ['allowComments' => 'allowComments'];
|
||||
|
||||
// get data and try to save them
|
||||
$data = EditContent::getFields($request, $fields);
|
||||
|
||||
$data['allowComments'] = (int)$data['allowComments'];
|
||||
|
||||
list($revision, $changedColumns) = $content->updateWithHistory($fields, $data, $revisionID);
|
||||
|
||||
// return amount of changed columns
|
||||
return $changedColumns;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public static function registerAdminMenu(User $user)
|
||||
{
|
||||
parent::registerAdminMenu($user);
|
||||
|
||||
$menu = \Menu::instance('mainMenu');
|
||||
|
||||
$menu->dropdown(trans('article::module.name'), function ($sub) {
|
||||
$sub->route('content.new', trans('article::article.new'), ['id' => self::getModuleId()], 10, ['icon' => 'fa fa-fw fa-pencil']);
|
||||
$sub->route('content.overview', trans('article::article.overview'), ['id' => self::getModuleId()], 30, ['icon' => 'fa fa-fw fa-book']);
|
||||
}, 10, ['icon' => 'fa fa-fw fa-book']);
|
||||
}
|
||||
|
||||
public static function getModuleId()
|
||||
{
|
||||
$handler = config('article.handler');
|
||||
$allModules = ModulesHandlerToId::getWithTranslations();
|
||||
$moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null;
|
||||
|
||||
return $moduleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install module
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function install()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
Route::group([
|
||||
'middleware' => 'web',
|
||||
'prefix' => 'article',
|
||||
'namespace' => 'Modules\Blog\Article\Http\Controllers'
|
||||
], function () {
|
||||
Route::get('/', 'CategoriesOverview@getOverview')
|
||||
->name('article.overview');
|
||||
|
||||
Route::get('/new', 'CreateNewCategory@getNew')
|
||||
->name('article.new');
|
||||
|
||||
Route::post('/new', 'CreateNewCategory@postNew')
|
||||
->name('article.postNew');
|
||||
|
||||
Route::get('/edit/{id}', 'EditCategory@getEdit')
|
||||
->name('article.edit');
|
||||
|
||||
Route::post('/edit/{id}', 'EditCategory@postEdit')
|
||||
->name('article.postEdit');
|
||||
|
||||
Route::get('/delete/{id}', 'EditCategory@delete')
|
||||
->name('article.delete');
|
||||
});
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php namespace Modules\Blog\Article\Providers;
|
||||
|
||||
use App\Handlers\Registrators\TemplateRegistrator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use InvalidArgumentException;
|
||||
use Modules\Blog\Article\Handlers\Article;
|
||||
use Pingpong\Modules\Facades\Module;
|
||||
|
||||
class ArticleServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([__DIR__.'/../Config/config.php' => config_path('article.php')]);
|
||||
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'article');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = base_path('resources/views/modules/article');
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath]);
|
||||
|
||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||
return $path . '/modules/article';
|
||||
}, \Config::get('view.paths')), [$sourcePath]), 'article');
|
||||
|
||||
/**
|
||||
* @var $registrator TemplateRegistrator
|
||||
*/
|
||||
try {
|
||||
// setup some global variables
|
||||
$registrator = $this->app->make('registerTemplateDir');
|
||||
$registrator->setBaseDirectory('resources/views/modules/article/visitor');
|
||||
$registrator->setNamespace('article');
|
||||
$registrator->setModuleId(Article::getModuleId());
|
||||
|
||||
// register path with current template name
|
||||
$registrator->register(config('app.theme'), 'article::admin/adminMenu.templatePath');
|
||||
} catch (InvalidArgumentException $e) {
|
||||
// ignore this exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = base_path('resources/lang/modules/article');
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'article');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'article');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
'allowComments' => 'Allow comments?',
|
||||
'new' => 'Write new',
|
||||
'overview' => 'All articles'
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
return [
|
||||
'name' => 'Article',
|
||||
'description' => 'Base submodule for blog'
|
||||
];
|
||||
@@ -0,0 +1,89 @@
|
||||
<div class="row">
|
||||
<div class="columns large-6">
|
||||
<label>
|
||||
@lang('admin/contents.field_title')
|
||||
|
||||
<input type="text" name="title" class="slug-source" placeholder="@lang('admin/contents.field_title')"
|
||||
value="{{old('title', $page->title)}}" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="columns large-4">
|
||||
<label>
|
||||
@lang('admin/contents.field_url')
|
||||
|
||||
<input type="text" name="url" class="slug-target" placeholder="@lang('admin/contents.field_url')"
|
||||
value="{{old('url', $page->url)}}" />
|
||||
|
||||
@if (isset($errors) && $errors->has('url'))
|
||||
<div class="callout alert">
|
||||
{{ $errors->first('url') }}
|
||||
</div>
|
||||
@endif
|
||||
</label>
|
||||
</div>
|
||||
<div class="column large-2 text-center">
|
||||
<label>
|
||||
@lang('admin/contents.lockUrl')<br />
|
||||
|
||||
<input type="checkbox" value="1" id="lockUrl"
|
||||
@if(old('lockUrl') || ($page->id > 0 && \Illuminate\Support\Str::slug($page->title) != $page->url)) checked
|
||||
@endif name="lockUrl" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-6">
|
||||
<label>
|
||||
<select name="status">
|
||||
@foreach($contentStatuses as $status => $translation)
|
||||
<option value="{{$status}}" @if(old('status', $page->status) == $status) selected @endif>
|
||||
{{$translation}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
|
||||
@if (isset($errors) && $errors->has('status'))
|
||||
<div class="callout alert">
|
||||
{{ $errors->first('status') }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="column large-6">
|
||||
<label>
|
||||
@lang('article::article.allowComments')
|
||||
<input type="checkbox" value="1" @if(old('allowComments', isset($page->module_settings->allowComments) ? $page->module_settings->allowComments : true)) checked @endif name="allowComments" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@if($module->support_categories && count($categories))
|
||||
<div class="column large-12">
|
||||
<label>
|
||||
@lang('admin/contents.category')
|
||||
|
||||
<select name="category">
|
||||
<option value=""> ---</option>
|
||||
@foreach($categories as $category)
|
||||
<option value="{{$category->id}}"
|
||||
@if($category->id == old('category', $page->category_id)) selected @endif>
|
||||
{{str_repeat(' - ', $category->real_depth)}} {{$category->name}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="columns large-12">
|
||||
<label>
|
||||
<textarea name="pageContent" id="pageContent" class="wysiwyg-editor">
|
||||
{{old('pageContent', $page->content)}}
|
||||
</textarea>
|
||||
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "pingpong-modules/article",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Pingpong Labs",
|
||||
"email": "pingpong.labs@gmail.com"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Article\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Namespaces And Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When a module starting, this file will executed automatically. This helps
|
||||
| to register some namespaces like translator or view. Also this file
|
||||
| will load the routes file for each module. You may also modify
|
||||
| this file as you want.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__ . '/Http/routes.php';
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'ArticleList'
|
||||
];
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php namespace Modules\Blog\ArticleList\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ArticleListDatabaseSeeder extends Seeder {
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php namespace Modules\Blog\ArticleList\Http\Controllers;
|
||||
|
||||
use Pingpong\Modules\Routing\Controller;
|
||||
|
||||
class ArticleListController extends Controller {
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('articlelist::index');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
Route::group(['middleware' => 'web', 'prefix' => 'articlelist', 'namespace' => 'Modules\Blog\ArticleList\Http\Controllers'], function()
|
||||
{
|
||||
Route::get('/', 'ArticleListController@index');
|
||||
});
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php namespace Modules\Blog\ArticleList\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ArticleListServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
__DIR__.'/../Config/config.php' => config_path('articlelist.php'),
|
||||
]);
|
||||
$this->mergeConfigFrom(
|
||||
__DIR__.'/../Config/config.php', 'articlelist'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = base_path('resources/views/modules/articlelist');
|
||||
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
]);
|
||||
|
||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||
return $path . '/modules/articlelist';
|
||||
}, \Config::get('view.paths')), [$sourcePath]), 'articlelist');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = base_path('resources/lang/modules/articlelist');
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'articlelist');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'articlelist');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@extends('articlelist::layouts.master')
|
||||
|
||||
@section('content')
|
||||
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>
|
||||
This view is loaded from module: {!! config('articlelist.name') !!}
|
||||
</p>
|
||||
|
||||
@stop
|
||||
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Module ArticleList</title>
|
||||
</head>
|
||||
<body>
|
||||
@yield('content')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Namespaces And Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When a module starting, this file will executed automatically. This helps
|
||||
| to register some namespaces like translator or view. Also this file
|
||||
| will load the routes file for each module. You may also modify
|
||||
| this file as you want.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__ . '/Http/routes.php';
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Comments',
|
||||
'translatedName' => 'comments::module.name',
|
||||
'translatedDescription' => 'comments::module.description',
|
||||
'alias' => 'blog-comments',
|
||||
'handler' => \Modules\Blog\Comments\Handlers\Comments::class,
|
||||
'providers' => [\Modules\Blog\Comments\Providers\CommentsServiceProvider::class],
|
||||
'files' => ['start.php'],
|
||||
'order' => 0,
|
||||
];
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace Modules\Blog\Comments\Handlers;
|
||||
|
||||
use App\Enumerations\ModulesHandlerToId;
|
||||
use App\Handlers\BaseHandler;
|
||||
use App\Models\User;
|
||||
|
||||
class Comments extends BaseHandler
|
||||
{
|
||||
public static function getModuleId()
|
||||
{
|
||||
$handler = config('comments.handler');
|
||||
$allModules = ModulesHandlerToId::getWithTranslations();
|
||||
$moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null;
|
||||
|
||||
return $moduleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install module
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function install()
|
||||
{
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
public static function registerAdminMenu(User $user)
|
||||
{
|
||||
$menu = \Menu::instance('mainMenu');
|
||||
|
||||
$menu->dropdown(trans('comments::module.name'), function ($sub) {
|
||||
$sub->route('comments.overview', trans('comments::module.overview'), [], 10, ['icon' => 'fa fa-fw fa-commenting-o']);
|
||||
}, 10, ['icon' => 'fa fa-fw fa-comments-o']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php namespace Modules\Blog\Comments\Http\Controllers;
|
||||
|
||||
use Pingpong\Modules\Routing\Controller;
|
||||
|
||||
class CommentsController extends Controller {
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('articlelist::index');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
Route::group(['middleware' => 'web', 'prefix' => 'comments', 'namespace' => 'Modules\Blog\Comments\Http\Controllers'], function()
|
||||
{
|
||||
Route::get('/', 'CommentsController@index')->name('comments.overview');
|
||||
});
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php namespace Modules\Blog\Comments\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class CommentsServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([__DIR__.'/../Config/config.php' => config_path('comments.php')]);
|
||||
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'comments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = base_path('resources/views/modules/comments');
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath]);
|
||||
|
||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||
return $path . '/modules/comments';
|
||||
}, \Config::get('view.paths')), [$sourcePath]), 'comments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = base_path('resources/lang/modules/comments');
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'comments');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'comments');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
'name' => 'Comments',
|
||||
'description' => "Bring comment support to blog module",
|
||||
'overview' => 'All comments'
|
||||
];
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Namespaces And Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When a module starting, this file will executed automatically. This helps
|
||||
| to register some namespaces like translator or view. Also this file
|
||||
| will load the routes file for each module. You may also modify
|
||||
| this file as you want.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__ . '/Http/routes.php';
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
'name' => 'Blog',
|
||||
'description' => '',
|
||||
'hasSubmodules' => true,
|
||||
];
|
||||
@@ -1,25 +1,26 @@
|
||||
<?php
|
||||
return [
|
||||
"backToEdit" => "Zpět na editaci obsahu",
|
||||
"backToOverview" => "Zpět na přehled historie",
|
||||
"changedFromTo" => "Změna z <del>:from</del> na <ins>:to</ins>",
|
||||
"columnFile" => "Přiřazené soubory",
|
||||
"columnIs_homepage" => "Domovská stránka",
|
||||
"columnMetaDescription" => "Popis",
|
||||
"columnMetaKeywords" => "Klíčová slova",
|
||||
"columnPageContent" => "Obsah stránky",
|
||||
"columnParentPage" => "Nadřazená stránka",
|
||||
"columnStatus" => "Viditelnost stránky",
|
||||
"columnTemplate" => "Šablona",
|
||||
"columnTitle" => "Titulek",
|
||||
"columnTitlePhotoFilename" => "Titulní obrázek",
|
||||
"columnUrl" => "URL",
|
||||
"deletedFile" => "Odebrán soubor <del>:file</del>.",
|
||||
"diff" => "Rozdíl",
|
||||
"diffPageName" => "Rozdíl v :column",
|
||||
"emptyValue" => "<em>nic</em>",
|
||||
"numOfChanges" => "Jedna změna|:count změny|:count změn",
|
||||
"pageName" => "Historie :name",
|
||||
"setupAsHomepage" => "Nastaveno jako domovská stránka",
|
||||
"uploadedFile" => "Nahrán soubor <ins>:file</ins>.",
|
||||
"backToEdit" => "Zpět na editaci obsahu",
|
||||
"backToOverview" => "Zpět na přehled historie",
|
||||
"changedFromTo" => "Změna z <del>:from</del> na <ins>:to</ins>",
|
||||
"columnCategory" => "Kategorie",
|
||||
"columnFile" => "Přiřazené soubory",
|
||||
"columnIs_homepage" => "Domovská stránka",
|
||||
"columnMetaDescription" => "Popis",
|
||||
"columnMetaKeywords" => "Klíčová slova",
|
||||
"columnPageContent" => "Obsah stránky",
|
||||
"columnParentPage" => "Nadřazená stránka",
|
||||
"columnStatus" => "Viditelnost stránky",
|
||||
"columnTemplate" => "Šablona",
|
||||
"columnTitle" => "Titulek",
|
||||
"columnTitlePhotoFilename" => "Titulní obrázek",
|
||||
"columnUrl" => "URL",
|
||||
"deletedFile" => "Odebrán soubor <del>:file</del>.",
|
||||
"diff" => "Rozdíl",
|
||||
"diffPageName" => "Rozdíl v :column",
|
||||
"emptyValue" => "<em>nic</em>",
|
||||
"numOfChanges" => "Jedna změna|:count změny|:count změn",
|
||||
"pageName" => "Historie :name",
|
||||
"setupAsHomepage" => "Nastaveno jako domovská stránka",
|
||||
"uploadedFile" => "Nahrán soubor <ins>:file</ins>.",
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user