/** * Visitors controller index action */ public function indexAction() { $this->breadcrumbsBlock->addBreadcrumb('Visitors', 'admin/visitors'); $collection = \Magelight\Db\Collection::forge(\Magelight\Visitors\Models\Visitor::orm()->orderByDesc('time'))->setLimit(30); $page = $this->request()->getRequest('page', 0); $this->view()->sectionReplace('content', \Magelight\Visitors\Blocks\VisitorsList::forge($collection, $page)); $this->renderView(); }
/** * Forgery constructor */ public function __forge() { $model = \Magelight\Visitors\Models\Visitor::forge(); $this->total_count = $model->orm()->totalCount(); $time = time(); $todayStart = $time - $time % 86400; $todayEnd = $todayStart + 86400; $this->today_count = $model->orm()->whereGt('time', $todayStart)->whereLt('time', $todayEnd)->totalCount(); }