Help me for this code ."Latest forum in homepage with pagination"

83
.
I need the latest forum code with paging. that will show all new posts on the homepage.
.
<?php exit;
# Hasan Mallick (15.09.2022 / 04:06)
I need the latest forum code with paging. that will show all new posts on the homepage.
Add to HomepageController
module_lib_loader('forum');
$last_topics = ForumTopic::query()->orderBy('last_post_date', 'DESC')->paginate(10);
$this->render->addData(
    [
        'last_topics' => $last_topics,
        'pagination' => $last_topics->render(),
    ]
);

Add to template
<?php foreach ($last_topics as $forum_topic): ?>
<div class="card m-2">
    <div class="card-body">
        <?= $forum_topic['name'] ?>
    </div>
</div>
<?php endforeach ?>
<?php if (! empty($pagination)): ?>
    <div class="mt-4"><?= $pagination ?></div>
<?php endif; ?>
.
if i set my website not working can you set in files please. 
Прикрепленные файлы:
.
Добавлено: 22.09.2022 / 05:40
Your code is not working.

Добавлено: 01.11.2022 / 20:25
please help me.
Всего: 4