app\locker\data\dashboards\BaseDashboard::statementDays PHP Метод

statementDays() защищенный Метод

Get a count of all the days from the first day a statement was submitted to Lrs.
protected statementDays ( )
    protected function statementDays()
    {
        $firstStatement = \DB::collection('statements');
        if ($this->has_lrs) {
            $firstStatement->where('lrs_id', new \MongoId($this->lrs));
        }
        $firstStatement = $firstStatement->orderBy("timestamp")->first();
        if ($firstStatement) {
            $firstDay = date_create(gmdate("Y-m-d", strtotime($firstStatement['statement']['timestamp'])));
            $today = date_create(gmdate("Y-m-d", time()));
            $interval = date_diff($firstDay, $today);
            $days = $interval->days + 1;
            return $days;
        } else {
            return '';
        }
    }