REFACTORING: move part of content business logic into repository

This commit is contained in:
Michal Kváček
2016-10-18 15:36:26 +02:00
parent eabbf48ee0
commit 662700b4f2
19 changed files with 504 additions and 383 deletions
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\CMS\Repositories;
use App\CMS\Contracts\Repositories\Module as IModule;
use App\Models\Module as ModuleModel;
class Module extends Repository implements IModule
{
public function getOne($id = null) {
if (!is_null($id)) {
return ModuleModel::find($id);
} else {
return new ModuleModel();
}
}
public function supportsCategories()
{
// TODO: Implement supportsCategories() method.
}
public function getCreateContentTitle()
{
// TODO: Implement getCreateContentTitle() method.
}
public function getUpdateContentTitle()
{
// TODO: Implement getUpdateContentTitle() method.
}
public function getOverviewTitle(ModuleModel $module)
{
$pageHeading = 'admin/contents.overview';
// does user want to filter results using module?
if (!is_null($module) && is_callable([$module->handler, 'getOverviewTitle'])) {
$pageHeading = call_user_func([$module->handler, 'getOverviewTitle']);
}
return $pageHeading;
}
public function all()
{
// TODO: Implement all() method.
}
}