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
+27 -10
View File
@@ -6,25 +6,42 @@ use App\Models\Module as ModuleModel;
class Module extends Repository implements IModule
{
public function getOne($id = null) {
/**
* @var ModuleModel
*/
private $module;
public function __construct(ModuleModel $module)
{
$this->module = $module;
}
public function getOne($id = null)
{
if (!is_null($id)) {
return ModuleModel::find($id);
if (is_numeric($id)) {
return ModuleModel::findOrFail($id);
} else {
return ModuleModel::where('alias', $id)
->firstOrFail();
}
} else {
return new ModuleModel();
}
}
public function supportsCategories()
public function getCreateContentTitle(ModuleModel $module)
{
// TODO: Implement supportsCategories() method.
$pageHeading = trans('admin/contents.new', ['name' => trans($module->name)]);
if (is_callable([$module->handler, 'getCreateNewTitle'])) {
$pageHeading = call_user_func([$module->handler, 'getCreateNewTitle']);
}
return $pageHeading;
}
public function getCreateContentTitle()
{
// TODO: Implement getCreateContentTitle() method.
}
public function getUpdateContentTitle()
public function getUpdateContentTitle(ModuleModel $module)
{
// TODO: Implement getUpdateContentTitle() method.
}