public function showIndex() { // the current page number $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; $perPage = 4; $totalCount = Topic::count(); $pagination = new Pagination($page, $perPage, $totalCount); $topics = Topic::allTopics($perPage, $pagination->offset()) or redirect(404); echo $this->blade->render('home', compact('topics', 'pagination')); }
public function showTopics() { $topics = Topic::allTopics(); echo $this->blade->render('topics', compact('topics')); }