FEATURE: add selecting comments into template in visitors area
This commit is contained in:
@@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Content;
|
||||
use App\Models\User;
|
||||
use Modules\Blog\Article\Entities\Comment;
|
||||
|
||||
class Article extends Handler
|
||||
{
|
||||
@@ -21,6 +22,14 @@ class Article extends Handler
|
||||
*/
|
||||
public function render(Content $content, $parameters)
|
||||
{
|
||||
$content->comments = [];
|
||||
if (isset($content->module_settings->allowComments) && $content->module_settings->allowComments) {
|
||||
$content->comments = Comment::where('content_id', $content->id)
|
||||
->where('approved', 1)
|
||||
->orderBy('created_at')
|
||||
->get();
|
||||
}
|
||||
|
||||
return Controller::VisitorsView($content->template, ['page' => $content]);
|
||||
}
|
||||
|
||||
@@ -79,7 +88,8 @@ class Article extends Handler
|
||||
return $changedColumns;
|
||||
}
|
||||
|
||||
public static function getOverviewTitle() {
|
||||
public static function getOverviewTitle()
|
||||
{
|
||||
return trans('article::module.allArticles');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user