FEATURE: add selecting comments into template in visitors area
This commit is contained in:
@@ -50,6 +50,9 @@ class ContentPage extends Controller
|
|||||||
throw new \Exception('Cannot access protected resources');
|
throw new \Exception('Cannot access protected resources');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// decode module settings
|
||||||
|
$page->module_settings = json_decode($page->module_settings);
|
||||||
|
|
||||||
// get handler
|
// get handler
|
||||||
$handler = new $page->module_handler;
|
$handler = new $page->module_handler;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\Content;
|
use App\Models\Content;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Modules\Blog\Article\Entities\Comment;
|
||||||
|
|
||||||
class Article extends Handler
|
class Article extends Handler
|
||||||
{
|
{
|
||||||
@@ -21,6 +22,14 @@ class Article extends Handler
|
|||||||
*/
|
*/
|
||||||
public function render(Content $content, $parameters)
|
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]);
|
return Controller::VisitorsView($content->template, ['page' => $content]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +88,8 @@ class Article extends Handler
|
|||||||
return $changedColumns;
|
return $changedColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getOverviewTitle() {
|
public static function getOverviewTitle()
|
||||||
|
{
|
||||||
return trans('article::module.allArticles');
|
return trans('article::module.allArticles');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user