<?php
 namespace App\Web\Controller; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Request; use ModStart\Core\Util\PageHtmlUtil; class IndexController extends BaseController { public function index() { $input = InputPackage::buildFromInput(); $page = $input->getPage(); $pageSize = 20; $option = []; $option['where'] = []; $option['order'] = ['postTime', 'desc']; $option['where']['isPublished'] = true; $paginateData = ModelUtil::paginate('blog', $page, $pageSize, $option); $pageHtml = PageHtmlUtil::render($paginateData['total'], $pageSize, $page, '?' . Request::mergeQueries(['page' => ['{page}']])); ModelUtil::decodeRecordsJson($paginateData['records'], 'images'); $blogList = $paginateData['records']; return $this->view('index', compact('pageHtml', 'blogList')); } }