FIX: add with methods to selecting comments and content pages

This commit is contained in:
Michal Kváček
2016-10-04 13:14:21 +02:00
parent ab90b907f8
commit 1e310f0da5
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -62,6 +62,7 @@ class Content extends Model
{ {
return Content::where('status', '!=', Content::STATUS_DRAFT) return Content::where('status', '!=', Content::STATUS_DRAFT)
->select('contents.*') ->select('contents.*')
->with('author')
->join('modules', 'modules.handler', '=', 'contents.module_handler') ->join('modules', 'modules.handler', '=', 'contents.module_handler')
->where('language', LaravelLocalization::getCurrentLocale()) ->where('language', LaravelLocalization::getCurrentLocale())
->where('modules.enabled', true); ->where('modules.enabled', true);
@@ -27,6 +27,7 @@ class Article extends Handler implements ContentTitles
$content->comments = []; $content->comments = [];
if (isset($content->module_settings->allowComments) && $content->module_settings->allowComments) { if (isset($content->module_settings->allowComments) && $content->module_settings->allowComments) {
$content->comments = Comment::where('content_id', $content->id) $content->comments = Comment::where('content_id', $content->id)
->with('author')
->where('approved', 1) ->where('approved', 1)
->orderBy('created_at') ->orderBy('created_at')
->get(); ->get();