FEATURE: add another repositories

This commit is contained in:
Michal Kváček
2016-10-18 22:35:06 +02:00
parent 662700b4f2
commit 4f6a006ad9
47 changed files with 410 additions and 400 deletions
+54 -14
View File
@@ -1,18 +1,20 @@
<?php
namespace Modules\Blog\Article\Handlers;
use App\CMS\Enumerations\ModulesHandlerToId;
use App\CMS\Contracts\Content\AdvancedContentModifier;
use App\CMS\Contracts\Modules\InstallableModule;
use App\CMS\Handlers\Contracts\ContentTitles;
use App\CMS\Handlers\Handler;
use App\Http\Controllers\Admin\Contents\EditContent;
use App\Http\Controllers\Controller;
use App\Http\Requests\Request;
use App\Models\ActionLogType;
use App\Models\ActionLog\ActionLogType;
use App\Models\Content\Content;
use App\Models\Module;
use App\Models\User;
use Modules\Blog\Article\Entities\Comment;
class Article extends Handler implements ContentTitles
class Article extends Handler implements ContentTitles, AdvancedContentModifier, InstallableModule
{
/**
* Render given module into visitor area.
@@ -109,22 +111,13 @@ class Article extends Handler implements ContentTitles
}
$blogSubmenu->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']);
$sub->route('content.new', trans('article::article.new'), ['id' => config('article.alias')], 10, ['icon' => 'fa fa-fw fa-pencil']);
$sub->route('content.overview', trans('article::article.overview'), ['id' => config('article.alias')], 30, ['icon' => 'fa fa-fw fa-book']);
}, 10, ['icon' => 'fa fa-fw fa-book']);
$blogSubmenu->route('comments.overview', trans('article::module.commentsOverview'), [], 20, ['icon' => 'fa fa-fw fa-commenting-o']);
}
public static function getModuleId()
{
$handler = config('article.handler');
$allModules = ModulesHandlerToId::getWithTranslations();
$moduleId = isset($allModules[$handler]) ? $allModules[$handler] : null;
return $moduleId;
}
/**
* Install module
*/
@@ -153,6 +146,19 @@ class Article extends Handler implements ContentTitles
}
}
/**
* Uninstalls module
*
* @param Module $module
*
* @return mixed|void
*/
public static function uninstall(Module $module)
{
ActionLogType::whereIn('string_id', ['commentCreated', 'commentDeleted', 'commentApproved'])
->delete();
}
/**
* Get translated title for pages overview of given type.
*
@@ -186,4 +192,38 @@ class Article extends Handler implements ContentTitles
{
return trans('article::module.editArticle');
}
/**
* Method called right after content page is marked as deleted
*
* This method is supposed to clean after "deleted" page.
*
* @param Content $content
*
* @return mixed
*/
public static function delete(Content $content)
{
}
/**
* Load some extra data for content management form?
*
* @param Content $content
*
* @return mixed
*/
public static function loadExtraData(Content $content)
{
}
/**
* Does this module support categories?
*
* @return boolean
*/
public static function supportCategories()
{
return true;
}
}