add controllers, servoices

This commit is contained in:
root
2026-03-09 02:52:13 -04:00
parent c8de5f7edc
commit d76c871cb7
501 changed files with 34439 additions and 21843 deletions
@@ -0,0 +1,41 @@
<?php
namespace App\Services\Semesters;
use App\Models\Configuration;
use DateTimeImmutable;
class SemesterConfigService
{
public function getFallStart(): ?DateTimeImmutable
{
return $this->parseDate(Configuration::getConfigValueByKey('fall_semester_start'));
}
public function getSpringStart(): ?DateTimeImmutable
{
return $this->parseDate(Configuration::getConfigValueByKey('spring_semester_start'));
}
public function getLastSchoolDay(): ?DateTimeImmutable
{
$value = Configuration::getConfigValueByKey('last_school_day')
?? Configuration::getConfigValueByKey('last_day_of_school');
return $this->parseDate($value);
}
private function parseDate(?string $value): ?DateTimeImmutable
{
$value = (string) ($value ?? '');
if ($value === '') {
return null;
}
try {
return new DateTimeImmutable($value);
} catch (\Throwable) {
return null;
}
}
}