FEATURE: merge template namespace and module alias

This commit is contained in:
Michal Kváček
2017-02-10 13:45:41 +01:00
parent 9451357e02
commit 35bda2828c
7 changed files with 16 additions and 26 deletions
@@ -1,6 +1,7 @@
<?php
namespace Modules\Blog\ArticleList\Handlers;
use App\CMS\Contracts\Repositories\Content as IContent;
use App\CMS\Handlers\Handler;
use App\Http\Controllers\Controller;
use App\Models\Content\Content;
@@ -109,11 +110,10 @@ class ArticleList extends Handler
->orderBy('created_at', 'DESC');
// show articles for not-logged users of even for logged onew?
if (!Auth::user()) {
$articles = $articles->where('status', Content::STATUS_PUBLIC);
} else {
$articles = $articles->whereIn('status', [Content::STATUS_PUBLIC, Content::STATUS_PROTECTED]);
}
$articles = !Auth::user() ? $articles->where('status', IContent::STATUS_PUBLIC) : $articles->whereIn('status', [
IContent::STATUS_PUBLIC,
IContent::STATUS_PROTECTED
]);
// selected articles from archive?
self::archive($articles);
@@ -129,12 +129,7 @@ class ArticleList extends Handler
$articles = $articles->where('user_id', $user->id);
}
$articles = $articles->paginate(20);
// decode module settings
foreach ($articles as $article) {
$article->moduleSettings = json_decode($article->moduleSettings);
}
$articles = $articles->paginate(setting('articlesPerPage', 20));
return Controller::VisitorsView($content->template, [
'page' => $content,