Beispiel #1
0
 public static function oneMonthViewOfDaysWithTelomeres($month, $year)
 {
     $days = Day::getAllDaysInSelectedMonth($month, $year);
     // get the first day of the month
     $firstDayInMonth = Day::getFirstDayInSelectedMonth($month, $year);
     // get the week of that day, get the first day in that week
     $firstDayInFirstWeek = $firstDayInMonth->firstDayInWeek();
     // get the last day of the month
     $lastDayInMonth = Day::getLastDayInSelectedMonth($month, $year);
     // get the week of that day, get the last day in that week
     $lastDayInLastWeek = $lastDayInMonth->lastDayInWeek();
     // get a colection of all days in between firstDayInFirstWeek & lastDayInLastWeek
     $oneMonthViewOfDaysWithTelomeres = Day::select()->whereBetween('id', [$firstDayInFirstWeek->id, $lastDayInLastWeek->id])->get();
     $monthName = Day::staticHumanMonthOfYear($month);
     $package = ['month' => $monthName, 'year' => $year, 'collection' => $oneMonthViewOfDaysWithTelomeres];
     return $package;
 }