Domain\Billet\GenerateBilletService::run PHP Метод

run() публичный Метод

public run ( $days )
    public function run($days)
    {
        $day = (int) date('d');
        $month = date('m');
        $year = date('Y');
        $lastDay = date('t');
        $twice = false;
        if ($day + $days > $lastDay) {
            $twice = true;
        }
        $students = $this->student->betweenDays($day, $day + $days);
        $this->createBillets($students, (int) "{$year}{$month}");
        if ($twice) {
            $day = date('d', strtotime('+' . $days . ' days'));
            $month = date('m', strtotime('+' . $days . ' days'));
            $year = date('Y', strtotime('+' . $days . ' days'));
            $students = $this->student->betweenDays($day, $day + $days);
            $this->createBillets($students, (int) "{$year}{$month}");
        }
        return true;
    }