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
+9 -2
View File
@@ -14,7 +14,7 @@ class Content extends Repository implements IContent
/**
* @var ContentModel
*/
private $model;
protected $model;
public function __construct(ContentModel $model)
{
@@ -54,9 +54,16 @@ class Content extends Repository implements IContent
$page = new ContentModel();
$page->user_id = \Auth::user()->id;
$page->language = LaravelLocalization::getCurrentLocale();
$page->status = IContent::STATUS_DRAFT;
$page->module_settings = [];
} else {
$page = $this->model->find($id);
if (is_numeric($id)) {
$page = $this->model->findOrFail($id);
} else {
$page = $this->model->where('language', LaravelLocalization::getCurrentLocale())
->where('url', $id)
->firstOrFail();
}
$page->module_settings = json_decode($page->module_settings);
}