<?php
 namespace Module\Event\Web\Controller; use ModStart\Core\Input\InputPackage; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Core\Util\PageHtmlUtil; use ModStart\Module\ModuleBaseController; class EventController extends ModuleBaseController { private $api; public function __construct() { $this->api = app(\Module\Event\Api\Controller\EventController::class); } public function index() { $paginateData = Response::tryGetData($this->api->paginate()); $categories = Response::tryGetData($this->api->categories()); $pageHtml = PageHtmlUtil::render($paginateData['total'], $paginateData['pageSize'], $paginateData['page'], Request::mergeQueries(['page' => ['{page}']])); return $this->view('event.list', [ 'currentCategory' => $paginateData['currentCategory'], 'page' => $paginateData['page'], 'pageSize' => $paginateData['pageSize'], 'total' => $paginateData['total'], 'records' => $paginateData['records'], 'pageHtml' => $pageHtml, 'categories' => $categories, ]); } public function show($id) { InputPackage::mergeToInput('id', $id); $event = Response::tryGetData($this->api->get()); return $this->view('event.show', [ 'event' => $event ]); } public function submit($id) { InputPackage::mergeToInput('id', $id); $event = Response::tryGetData($this->api->get()); return $this->view('event.submit', [ 'event' => $event ]); } } 