/** * 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(); }